diff options
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java index 72b32f465..2ba3338ca 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java @@ -15,6 +15,7 @@ import java.math.BigInteger; import java.util.*; import junit.framework.*; import org.eclipse.osgi.framework.util.CaseInsensitiveDictionaryMap; +import org.eclipse.osgi.tests.util.MapDictionary; import org.osgi.framework.*; public abstract class FilterTests extends TestCase { @@ -344,6 +345,21 @@ public abstract class FilterTests extends TestCase { assertFalse("does match filter", f1.match(new DictionaryServiceReference(hash))); } + public void testNullValueMatch() throws InvalidSyntaxException { + Dictionary<String, Object> nullProps = new MapDictionary<String, Object>(); + nullProps.put("test.null", null); + nullProps.put("test.non.null", "v1"); + assertFalse(createFilter("(test.null=*)").match(nullProps)); + assertTrue(createFilter("(&(!(test.null=*))(test.non.null=v1))").match(nullProps)); + } + + public void testNullKeyMatch() throws InvalidSyntaxException { + Dictionary<String, Object> nullProps = new MapDictionary<String, Object>(); + nullProps.put(null, "null.v1"); + nullProps.put("test.non.null", "v1"); + assertTrue(createFilter("(test.non.null=v1)").match(nullProps)); + } + public static class SampleComparable implements Comparable { private int value = -1; |