]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.db.tests/src/org/simantics/db/tests/api/readGraph/getInverse/GetInverseTest1.java
Added missing org.simantics.db.{tests,testing} plug-ins.
[simantics/platform.git] / tests / org.simantics.db.tests / src / org / simantics / db / tests / api / readGraph / getInverse / GetInverseTest1.java
diff --git a/tests/org.simantics.db.tests/src/org/simantics/db/tests/api/readGraph/getInverse/GetInverseTest1.java b/tests/org.simantics.db.tests/src/org/simantics/db/tests/api/readGraph/getInverse/GetInverseTest1.java
new file mode 100644 (file)
index 0000000..1c5f52f
--- /dev/null
@@ -0,0 +1,28 @@
+package org.simantics.db.tests.api.readGraph.getInverse;
+
+import org.junit.Test;
+import org.simantics.db.Resource;
+import org.simantics.db.common.primitiverequest.Inverse;
+import org.simantics.db.exception.NoInverseException;
+import org.simantics.db.testing.base.ExistingDatabaseTest;
+import org.simantics.db.tests.common.Writes;
+
+/*
+ * When a resource does not specify L0.InverseOf, getInverse shall throw NoInverseException.
+ */
+public class GetInverseTest1 extends ExistingDatabaseTest {
+       
+       @Test
+       public void test() throws Exception{
+
+               Resource resource = getSession().syncRequest(Writes.newEmpty());
+
+               try {
+                       assertNotNull("Null not allowed",getSession().syncRequest(new Inverse(resource)));
+               } catch (NoInverseException e) {
+                       return;
+               }
+        fail("Should throw.");
+       }
+       
+}