diff options
author | James Moger <james.moger@gmail.com> | 2012-10-15 12:17:02 -0400 |
---|---|---|
committer | James Moger <james.moger@gmail.com> | 2012-10-15 12:17:02 -0400 |
commit | 6d3704b7bad4732a289c0be68e8f18a1fdf8abac (patch) | |
tree | fd4e7153189aba4af06859d1d31dce5cb31f3c93 /tests | |
parent | ef95be59dbd124ee07d195ef3706e1daaa25f768 (diff) | |
download | iciql-6d3704b7bad4732a289c0be68e8f18a1fdf8abac.tar.gz iciql-6d3704b7bad4732a289c0be68e8f18a1fdf8abac.zip |
Added drop reference table test (fails on H2)
Unfortunately, it looks like H2 1.3.168 has a bug which allows you to
drop a table even though there are active constraints referencing it.
HSQL, Derby, MySQL, and PostgreSQL all throw a constraint violation
exception, as expected, but H2 does not.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/com/iciql/test/ForeignKeyTest.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/com/iciql/test/ForeignKeyTest.java b/tests/com/iciql/test/ForeignKeyTest.java index 3e0314c..d789408 100644 --- a/tests/com/iciql/test/ForeignKeyTest.java +++ b/tests/com/iciql/test/ForeignKeyTest.java @@ -17,12 +17,14 @@ package com.iciql.test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.iciql.Db;
+import com.iciql.IciqlException;
import com.iciql.test.models.CategoryAnnotationOnly;
import com.iciql.test.models.ProductAnnotationOnlyWithForeignKey;
@@ -62,6 +64,15 @@ public class ForeignKeyTest { assertEquals(count1, count2 + 2L);
}
-
+
+ @Test
+ public void testForeignKeyDropReferenceTable() {
+ try {
+ db.dropTable(CategoryAnnotationOnly.class);
+ assertTrue("Should not be able to drop reference table!", false);
+ } catch (IciqlException e) {
+ assertEquals(e.getMessage(), IciqlException.CODE_CONSTRAINT_VIOLATION, e.getIciqlCode());
+ }
+ }
}
|