JAL-2808 added conditions Present, NotPresent as options
[jalview.git] / test / jalview / util / matcher / MatcherTest.java
index ee0ff82..f4c8181 100644 (file)
@@ -167,6 +167,22 @@ public class MatcherTest
     assertTrue(m.matches(null));
 
     /*
+     * value is present (is not null)
+     */
+    m = new Matcher(Condition.Present, null);
+    assertTrue(m.matches("benign"));
+    assertTrue(m.matches(""));
+    assertFalse(m.matches(null));
+
+    /*
+     * value is not present (is null)
+     */
+    m = new Matcher(Condition.NotPresent, null);
+    assertFalse(m.matches("benign"));
+    assertFalse(m.matches(""));
+    assertTrue(m.matches(null));
+
+    /*
      * a float with a string match condition will be treated as string
      */
     Matcher m1 = new Matcher(Condition.Contains, "32");