Skip to content

Commit 4f4f2cf

Browse files
committed
cleaner test resource management
this fixes windows builds
1 parent 82db502 commit 4f4f2cf

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cayenne-ant/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ private void cleanDb(DbImportConfiguration dbImportConfiguration) throws Excepti
175175

176176
@SuppressWarnings("unchecked")
177177
private void verifyResult(File map, File mapFileCopy) throws IOException {
178-
FileReader control = new FileReader(map.getAbsolutePath() + "-result");
179-
FileReader test = new FileReader(mapFileCopy);
180-
assertThat(test, CompareMatcher.isSimilarTo(control).ignoreWhitespace());
178+
try (FileReader control = new FileReader(map.getAbsolutePath() + "-result");
179+
FileReader test = new FileReader(mapFileCopy)) {
180+
assertThat(test, CompareMatcher.isSimilarTo(control).ignoreWhitespace());
181+
}
181182
}
182183

183184
private void prepareDatabase(String sqlFile, DbImportConfiguration dbImportConfiguration) throws Exception {

0 commit comments

Comments
 (0)