1 package org.simantics.db.tests.api.readGraph.getInverse;
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.WriteGraph;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.db.exception.NoInverseException;
8 import org.simantics.db.testing.base.WriteReadTest;
11 * When a resource does not specify L0.InverseOf, getInverse shall throw NoInverseException.
13 public class GetInverseTest2 extends WriteReadTest {
14 private Resource relation1;
17 protected void write(WriteGraph graph) throws DatabaseException {
19 //Create first resource and give it a name
20 relation1 = graph.newResource();
21 graph.claim(relation1, L0.Inherits, L0.Relation);
25 protected void read(ReadGraph graph) throws DatabaseException {
27 assertNotNull("Null not allowed", graph.getInverse(relation1));
28 } catch (NoInverseException e) {
30 } catch(Throwable t) {
31 fail("Wrong exception was thrown " + t);
34 fail("No exception was thrown!");