NO-JIRA Fix minor leak in FileMoveManagerTest
Not closing the InputStream makes this test flaky on Windows. The test breaks because FileMoveManager::delete(java.io.File) Line 221 fails to delete the file if it's still "owned" by the JVM process on Windows.
This commit is contained in:
parent
366005e44f
commit
32fd445dd2
|
@ -352,11 +352,12 @@ public class FileMoveManagerTest {
|
|||
|
||||
private void checkFile(File bkpFolder, String file) throws IOException {
|
||||
File fileRead = new File(bkpFolder, file);
|
||||
InputStreamReader stream = new InputStreamReader(new FileInputStream(fileRead));
|
||||
BufferedReader reader = new BufferedReader(stream);
|
||||
String valueRead = reader.readLine();
|
||||
int id = Integer.parseInt(file.substring(0, file.indexOf('.')));
|
||||
Assert.assertEquals("content of the file wasn't the expected", id, Integer.parseInt(valueRead));
|
||||
try (InputStreamReader stream = new InputStreamReader(new FileInputStream(fileRead))) {
|
||||
BufferedReader reader = new BufferedReader(stream);
|
||||
String valueRead = reader.readLine();
|
||||
int id = Integer.parseInt(file.substring(0, file.indexOf('.')));
|
||||
Assert.assertEquals("content of the file wasn't the expected", id, Integer.parseInt(valueRead));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue