]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.db.tests/src/org/simantics/db/tests/api/readGraph/getInverse/GetInverseTest2.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 / GetInverseTest2.java
1 package org.simantics.db.tests.api.readGraph.getInverse;
2
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;
9
10 /*
11  * When a resource does not specify L0.InverseOf, getInverse shall throw NoInverseException.
12  */
13 public class GetInverseTest2 extends WriteReadTest {
14         private Resource relation1;
15
16         @Override
17         protected void write(WriteGraph graph) throws DatabaseException {
18
19         //Create first resource and give it a name
20         relation1 = graph.newResource();
21         graph.claim(relation1, L0.Inherits, L0.Relation);
22         }
23
24         @Override
25         protected void read(ReadGraph graph) throws DatabaseException {
26         try {
27                 assertNotNull("Null not allowed", graph.getInverse(relation1));
28         } catch (NoInverseException e) {
29             return;
30         } catch(Throwable t) {
31             fail("Wrong exception was thrown " + t);
32         }
33         
34         fail("No exception was thrown!");
35         }
36         
37 }