Skip to content

Commit

Permalink
Remove sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Feb 11, 2024
1 parent 916531d commit a9aa53a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Response catalogListFilterType( @PathParam("type") String type ) {
DocCatalogSample.getInstance().getPlaygroundCoreCatalog()
.stream().filter( e -> type.equalsIgnoreCase( e.getType() ) ).map(
e -> new OptionItem( e.getId(), e.getDescription() )
).collect( Collectors.toList() ) ).build()
).toList() ).build()
);
}

Expand All @@ -42,7 +42,7 @@ public Response catalogList() {
DocCatalogSample.getInstance().getPlaygroundCoreCatalog()
.stream().map(
e -> new OptionItem( e.getId(), e.getDescription() )
).collect( Collectors.toList() ) ).build()
).toList() ).build()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static boolean isInTmpFolder( File tempFile ) throws IOException {
public static Response doIfInTmpFolder(File tempFile, UnsafeSupplier<Response, Exception> fun ) throws IOException {
Response res = null;
if ( isInTmpFolder( tempFile ) ) {
res = HelperIOException.get( () -> fun.get() );
res = HelperIOException.get( fun::get );
} else {
// no access
res = Response.status(Response.Status.UNAUTHORIZED).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import java.io.File;
import java.io.IOException;

public class ValUtilsTest {
class ValUtilsTest {

@Test
public void testDoIfInTmpFolder401() throws IOException {
void testDoIfInTmpFolder401() throws IOException {
Response response = ValUtils.doIfInTmpFolder(new File("/"), () -> null);
Assertions.assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), response.getStatus() );
}

@Test
public void testDoIfInTmpFolder200() throws IOException {
void testDoIfInTmpFolder200() throws IOException {
Response response = ValUtils.doIfInTmpFolder( new File( System.getProperty( "java.io.tmpdir" ), "test.txt" ), () -> null);
Assertions.assertNull( response );
}
Expand Down

0 comments on commit a9aa53a

Please sign in to comment.