JAL-3010 unit test verify root SO terms are cached
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Sat, 20 Apr 2019 07:47:11 +0000 (08:47 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Sat, 20 Apr 2019 07:47:11 +0000 (08:47 +0100)
test/jalview/ext/so/SequenceOntologyTest.java

index 489e462..9cfbe88 100644 (file)
@@ -32,11 +32,14 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import junit.extensions.PA;
+
 public class SequenceOntologyTest
 {
 
@@ -198,5 +201,19 @@ public class SequenceOntologyTest
     roots = so.getRootParents("alanine");
     assertEquals(roots.size(), 1);
     assertEquals(roots.get(0), "sequence_feature");
+
+    /*
+     * verify these are now cached
+     */
+    Map<String, List<String>> cached = (Map<String, List<String>>) PA
+            .getValue(so, "rootParents");
+    List<String> parents = cached.get("stop_gained");
+    assertEquals(parents.size(), 1);
+    parents = cached.get("sequence_variant");
+    assertEquals(parents.size(), 1);
+    assertTrue(parents.contains("sequence_variant"));
+    parents = cached.get("alanine");
+    assertEquals(parents.size(), 1);
+    assertTrue(parents.contains("sequence_feature"));
   }
 }