Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import static java.util.concurrent.Executors.newFixedThreadPool;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -116,11 +117,10 @@ void testDeleteDirectoryOnIOException() throws Exception {
ExecutorService executor = newSingleThreadExecutor();
executor.submit(this::testDeleteDirectoryOnIOException0);
shutdown(executor);
while (!executor.isTerminated()) {
}
executor.awaitTermination(5, SECONDS);
}

Void testDeleteDirectoryOnIOException0() throws Exception {
File testDeleteDirectoryOnIOException0() throws Exception {
File testDir = createRandomTempDirectory();

ExecutorService fileCreationExecutor = newSingleThreadExecutor();
Expand Down Expand Up @@ -170,7 +170,7 @@ Void testDeleteDirectoryOnIOException0() throws Exception {
assertFalse(creatingFile.get());
assertFalse(deletingDirectory.get());

return null;
return testDir;
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ void testSplit() {

String[] assertSplit(String str, String delimiter) {
String[] values = split(str, delimiter);
if (length(delimiter) == 1) {
int length = length(delimiter);
if (length == 1) {
assertArrayEquals(split(str, delimiter.charAt(0)), values);
} else if (length > 1) {
String[] valuesFromString = delimitedListToStringArray(str, delimiter);
assertArrayEquals(valuesFromString, values);
}
String[] valuesFromString = delimitedListToStringArray(str, delimiter);
assertArrayEquals(valuesFromString, values);
return values;
}

Expand Down Expand Up @@ -177,11 +179,10 @@ void testEndsWith() {
@Test
void testReplace() {
assertNull(replace(null, null, null));

assertEquals(TEST_EMPTY_STRING, replace(TEST_EMPTY_STRING, null, null));
assertEquals(TEST_EMPTY_STRING, replace(TEST_EMPTY_STRING, "null", null));
assertEquals(TEST_CSV_STRING, replace(TEST_CSV_STRING, "null", "null"));

assertEquals(TEST_EMPTY_STRING, replace(TEST_EMPTY_STRING, null, null));
assertEquals(TEST_EMPTY_STRING, replace(TEST_EMPTY_STRING, TEST_EMPTY_STRING, null));
assertEquals(TEST_EMPTY_STRING, replace(TEST_EMPTY_STRING, TEST_EMPTY_STRING, TEST_EMPTY_STRING, 0));

Expand Down