Skip to content
Merged
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 @@ -316,7 +316,7 @@ public void shouldReturnEmptyArrayIfStateDirDoesntExist() throws IOException {
}

@Test
public void shouldReturnEmptyArrayIfListFilesReturnsNull() {
public void shouldReturnEmptyArrayIfListFilesReturnsNull() throws IOException {
stateDir = new File(TestUtils.IO_TMP_DIR, "kafka-" + TestUtils.randomString(5));
directory = new StateDirectory(
new StreamsConfig(new Properties() {
Expand All @@ -329,9 +329,12 @@ public void shouldReturnEmptyArrayIfListFilesReturnsNull() {
time, true);
appDir = new File(stateDir, applicationId);

assertTrue(stateDir.renameTo(new File(TestUtils.IO_TMP_DIR, "state-renamed")));

assertTrue(Arrays.asList(directory.listAllTaskDirectories()).isEmpty());
// make sure the File#listFiles returns null and StateDirectory#listAllTaskDirectories is able to handle null
Utils.delete(appDir);
assertTrue(appDir.createNewFile());
assertTrue(appDir.exists());
assertNull(appDir.listFiles());
assertEquals(0, directory.listAllTaskDirectories().length);
}

@Test
Expand Down