Skip to content

Commit

Permalink
Automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Aug 3, 2023
1 parent 36033fe commit 48209e8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/java/de/cuioss/tools/string/TextSplitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private String bruteForceSplit(final String text) {
builder.append(tmp, 0, maxLength).append(ZERO_WIDTH_SPACE);
tmp = tmp.substring(maxLength);
}
if (tmp.length() > 0) {
if (!tmp.isEmpty()) {
builder.append(tmp);
}
return builder.toString();
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/de/cuioss/tools/io/FileLoaderUtilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ void shouldFailToProvideLoaderOnNull() {

@Test
void shouldReturnLoaderForPaths() {
assertEquals(getLoaderForPath(FileTypePrefix.CLASSPATH + EXISTING_FILE_NAME).getClass(), ClassPathLoader.class);
assertEquals(getLoaderForPath(FileTypePrefix.FILE + EXISTING_FILE_NAME).getClass(), FileSystemLoader.class);
assertEquals(getLoaderForPath(EXISTING_FILE_NAME).getClass(), FileSystemLoader.class);
assertEquals(getLoaderForPath(NOT_EXISTING_FILE).getClass(), FileSystemLoader.class);
assertEquals(ClassPathLoader.class, getLoaderForPath(FileTypePrefix.CLASSPATH + EXISTING_FILE_NAME).getClass());
assertEquals(FileSystemLoader.class, getLoaderForPath(FileTypePrefix.FILE + EXISTING_FILE_NAME).getClass());
assertEquals(FileSystemLoader.class, getLoaderForPath(EXISTING_FILE_NAME).getClass());
assertEquals(FileSystemLoader.class, getLoaderForPath(NOT_EXISTING_FILE).getClass());
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/de/cuioss/tools/io/IOStreamsCopyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class IOStreamsCopyTest {
private byte[] iarr = null;

@BeforeEach
public void setUp() {
void setUp() {
// Create and init a byte array as input data
iarr = new byte[200];
Arrays.fill(iarr, (byte) -1);
Expand Down
13 changes: 5 additions & 8 deletions src/test/java/de/cuioss/tools/io/MorePathsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static de.cuioss.tools.io.MorePaths.getBackupDirectoryForPath;
import static de.cuioss.tools.io.MorePaths.getRealPathSafely;
import static de.cuioss.tools.io.MorePaths.saveAndBackup;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
Expand Down Expand Up @@ -241,11 +242,9 @@ private Path copyTestFileToPlayground() throws IOException {

@Test
void testDeleteQuietlyForNull() {
try {
assertDoesNotThrow(() -> {
assertFalse(deleteQuietly(null));
} catch (final Exception ex) {
fail(ex.getMessage());
}
});
}

@Test
Expand Down Expand Up @@ -277,11 +276,9 @@ void testDeleteQuietlyNonExistent() {
var testFile = playGroundBase.resolve(POM_XML);
assertFalse(testFile.toFile().exists());

try {
assertDoesNotThrow(() -> {
assertFalse(deleteQuietly(testFile));
} catch (final Exception ex) {
fail(ex.getMessage());
}
});
}

@Test
Expand Down

0 comments on commit 48209e8

Please sign in to comment.