Fix conditional unit test skipping Change If4ae2aaec added assumeNoException calls in the test classes' @Before annotated methods to skip testing for databases that are either not installed or not properly configured on the system. I29ab37e1c broke that, by moving database cleanup operation from setUp() to tearDown(), but not taking into consideration, that when test was skipped, executor wasn't properly instantiated and it come to NPE in tearDown() method. Failures in tearDown() then caused test to be marked as failed. Change-Id: I6964feedbe44ad9849c4feaa2565d0089a84509a
diff --git a/src/test/java/com/google/gwtorm/schema/sql/DialectMySQLTest.java b/src/test/java/com/google/gwtorm/schema/sql/DialectMySQLTest.java index 186134a..4f0b255 100644 --- a/src/test/java/com/google/gwtorm/schema/sql/DialectMySQLTest.java +++ b/src/test/java/com/google/gwtorm/schema/sql/DialectMySQLTest.java
@@ -81,6 +81,10 @@ @After public void tearDown() { + if (executor == null) { + return; + } + // Database content must be flushed because // tests assume that the database is empty drop("TABLE address_id");
diff --git a/src/test/java/com/google/gwtorm/schema/sql/DialectOracleSQLTest.java b/src/test/java/com/google/gwtorm/schema/sql/DialectOracleSQLTest.java index 8f75bb1..b7d501c 100644 --- a/src/test/java/com/google/gwtorm/schema/sql/DialectOracleSQLTest.java +++ b/src/test/java/com/google/gwtorm/schema/sql/DialectOracleSQLTest.java
@@ -80,6 +80,10 @@ @After public void tearDown() { + if (executor == null) { + return; + } + // Database content must be flushed because // tests assume that the database is empty drop("SEQUENCE address_id");
diff --git a/src/test/java/com/google/gwtorm/schema/sql/DialectPostgreSQLTest.java b/src/test/java/com/google/gwtorm/schema/sql/DialectPostgreSQLTest.java index 0330b18..6922aa5 100644 --- a/src/test/java/com/google/gwtorm/schema/sql/DialectPostgreSQLTest.java +++ b/src/test/java/com/google/gwtorm/schema/sql/DialectPostgreSQLTest.java
@@ -79,6 +79,10 @@ @After public void tearDown() { + if (executor == null) { + return; + } + // Database content must be flushed because // tests assume that the database is empty drop("SEQUENCE address_id");