From 2bee7a4b46f64786033ee112f10f0c4bd255740e Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Tue, 15 Nov 2011 02:52:21 +0000 Subject: [PATCH] add some cleanup code to unit tests git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@594 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/DatabaseTest.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index 2c70a19..4cfd656 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -183,6 +183,8 @@ public class DatabaseTest extends TestCase { } catch(IllegalArgumentException e) { // success } + + db.close(); } } @@ -193,7 +195,8 @@ public class DatabaseTest extends TestCase { while (table.getNextRow() != null) { rows++; } - assertEquals(2, rows); + assertEquals(2, rows); + table.getDatabase().close(); } } @@ -240,6 +243,8 @@ public class DatabaseTest extends TestCase { checkTestDBTable1RowABCDEFG(testDB, table, row1); checkTestDBTable1RowA(testDB, table, row2); + + db.close(); } } @@ -287,6 +292,7 @@ public class DatabaseTest extends TestCase { for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) { Database db = create(fileFormat); assertEquals(0, db.getTableNames().size()); + db.close(); } } @@ -312,6 +318,8 @@ public class DatabaseTest extends TestCase { assertEquals(row[6], readRow.get("G")); assertEquals(row[7], readRow.get("H")); } + + db.close(); } } @@ -338,6 +346,8 @@ public class DatabaseTest extends TestCase { assertEquals(row[6], readRow.get("G")); assertEquals(row[7], readRow.get("H")); } + + db.close(); } } @@ -402,6 +412,8 @@ public class DatabaseTest extends TestCase { assertRowCount(7, table); table.reset(); assertEquals(2, table.getNextRow().get("D")); + + db.close(); } } @@ -419,6 +431,8 @@ public class DatabaseTest extends TestCase { byte[] expectedBinaryData = toByteArray(new File("test/data/test2BinData.dat")); assertTrue(Arrays.equals(expectedBinaryData, foundBinaryData)); + + db.close(); } } @@ -455,6 +469,8 @@ public class DatabaseTest extends TestCase { assertEquals(testStr, row.get("A")); assertEquals(longMemo, row.get("B")); assertTrue(Arrays.equals(oleValue, (byte[])row.get("C"))); + + db.close(); } } @@ -566,6 +582,8 @@ public class DatabaseTest extends TestCase { } rowNum++; } + + table.getDatabase().close(); } } @@ -601,6 +619,8 @@ public class DatabaseTest extends TestCase { } catch(IOException e) { // ignored } + + db.close(); } } @@ -641,6 +661,8 @@ public class DatabaseTest extends TestCase { } catch(IOException e) { // ignored } + + db.close(); } } @@ -692,6 +714,8 @@ public class DatabaseTest extends TestCase { } catch(IOException e) { // ignored } + + db.close(); } } @@ -776,6 +800,8 @@ public class DatabaseTest extends TestCase { table.reset(); assertRowCount(7, table); + + mdb.close(); } } @@ -798,6 +824,8 @@ public class DatabaseTest extends TestCase { assertEquals(new Integer(1), readRow.get("a")); assertEquals(lval, readRow.get("b")); assertEquals(tval, readRow.get("c")); + + db.close(); } } @@ -979,6 +1007,8 @@ public class DatabaseTest extends TestCase { Date found = foundDates.get(i); assertSameDate(expected, found); } + + db.close(); } } -- 2.39.5