JAL-3383 tidy up NCList and alternatives
[jalview.git] / test / intervalstore / nonc / IntervalStoreTest.java
index 581f5f4..2c4e14b 100644 (file)
@@ -60,7 +60,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testFindOverlaps_nonNested()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 20);
     // same range different description
     SimpleFeature sf2 = new SimpleFeature(10, 20, "desc");
@@ -100,7 +100,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testFindOverlaps_nested()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 50);
     SimpleFeature sf2 = add(store, 10, 40);
     SimpleFeature sf3 = add(store, 20, 30);
@@ -138,7 +138,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testFindOverlaps_mixed()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 50);
     SimpleFeature sf2 = add(store, 1, 15);
     SimpleFeature sf3 = add(store, 20, 30);
@@ -195,7 +195,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testRemove()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 20);
     assertTrue(store.contains(sf1));
 
@@ -261,31 +261,10 @@ public class IntervalStoreTest
     assertTrue(store.isEmpty());
   }
 
-  /**
-   * A helper method to test whether a list contains a specific object (by
-   * object identity, not equality test as used by List.contains())
-   * 
-   * @param list
-   * @param o
-   * @return
-   */
-  private static boolean containsObject(List<? extends Object> list,
-          Object o)
-  {
-    for (Object i : list)
-    {
-      if (i == o)
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
   @Test(groups = "Functional")
   public void testAdd()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
 
     assertFalse(store.add(null));
 
@@ -315,7 +294,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testAdd_noDuplicates()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
 
     SimpleFeature sf1 = new SimpleFeature(10, 20, "Cath");
     SimpleFeature sf2 = new SimpleFeature(10, 20, "Cath");
@@ -331,7 +310,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testIsEmpty()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     assertTrue(store.isEmpty());
     assertEquals(store.size(), 0);
 
@@ -384,7 +363,7 @@ public class IntervalStoreTest
     /*
      * add a feature and a nested feature
      */
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 20);
     // sf2 is nested in sf1 so will be stored in nestedFeatures
     SimpleFeature sf2 = add(store, 12, 14);
@@ -410,7 +389,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testContains()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = new SimpleFeature(10, 20, "Cath");
     SimpleFeature sf2 = new SimpleFeature(10, 20, "Pfam");
 
@@ -447,7 +426,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testFindOverlaps_resultsArg_mixed()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 50);
     SimpleFeature sf2 = add(store, 1, 15);
     SimpleFeature sf3 = add(store, 20, 30);
@@ -510,7 +489,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testFindOverlaps_resultsArg_nested()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 50);
     SimpleFeature sf2 = add(store, 10, 40);
     SimpleFeature sf3 = add(store, 20, 30);
@@ -552,7 +531,7 @@ public class IntervalStoreTest
   @Test(groups = "Functional")
   public void testFindOverlaps_resultsArg_nonNested()
   {
-    IntervalStore<SimpleFeature> store = new IntervalStoreImpl();
+    IntervalStore<SimpleFeature> store = new IntervalStore<>();
     SimpleFeature sf1 = add(store, 10, 20);
     // same range different description
     SimpleFeature sf2 = new SimpleFeature(10, 20, "desc");
@@ -669,7 +648,8 @@ public class IntervalStoreTest
       }
       if (!isNCList)
       {
-        ((intervalstore.nonc.IntervalStore) store).revalidate();
+        ((intervalstore.nonc.IntervalStore<SimpleFeature>) store)
+                .revalidate();
       }
       String line = "time to load " + (isNCList ? "NClist " : "NCArray ")
               + (System.nanoTime() - ntimeLoad) / K / K + " ms scale "