X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=tests%2Forg.simantics.db.tests%2Fsrc%2Forg%2Fsimantics%2Fdb%2Ftests%2Fapi%2FreadGraph%2FgetInverse%2FGetInverseTest1.java;fp=tests%2Forg.simantics.db.tests%2Fsrc%2Forg%2Fsimantics%2Fdb%2Ftests%2Fapi%2FreadGraph%2FgetInverse%2FGetInverseTest1.java;h=1c5f52f44c5ea21d393b958cee64e656fa5e63b4;hb=67fd62f9c742337ec80eef658192db198a0efaac;hp=0000000000000000000000000000000000000000;hpb=cde82ba81327d5515fdca362f7f4c70f5103ae80;p=simantics%2Fplatform.git 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 index 000000000..1c5f52f44 --- /dev/null +++ b/tests/org.simantics.db.tests/src/org/simantics/db/tests/api/readGraph/getInverse/GetInverseTest1.java @@ -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."); + } + +}