public void testEmptySet() { final ObjectNameQuery q = new ObjectNameQueryImpl(); assertEquals(0, q.matchAny(EmptySet, null, null).size()); assertEquals(0, q.matchAny(EmptySet, EmptyStrings, EmptyStrings).size()); assertEquals(0, q.matchAny(EmptySet, null, EmptyStrings).size()); assertEquals(0, q.matchAny(EmptySet, EmptyStrings, null).size()); assertEquals(0, q.matchAll(EmptySet, null, null).size()); assertEquals(0, q.matchAll(EmptySet, EmptyStrings, EmptyStrings).size()); assertEquals(0, q.matchAll(EmptySet, null, EmptyStrings).size()); assertEquals(0, q.matchAll(EmptySet, EmptyStrings, null).size()); }
public void testSingleItem() { final ObjectName name1 = createName(":name=test,type=test"); final Set testSet = createSet(name1); final ObjectNameQuery q = new ObjectNameQueryImpl(); assertEquals(1, q.matchAny(testSet, null, null).size()); assertEquals(1, q.matchAny(testSet, new String[] {"type"}, new String[] {"test"}).size()); assertEquals(1, q.matchAny(testSet, new String[] {"type"}, null).size()); assertEquals(1, q.matchAny(testSet, null, new String[] {"test"}).size()); assertEquals(1, q.matchAny(testSet, new String[] {"t.*"}, new String[] {".*e.*"}).size()); assertEquals(1, q.matchAny(testSet, null, new String[] {".*e.*"}).size()); assertEquals(0, q.matchAny(testSet, EmptyStrings, EmptyStrings).size()); assertEquals(0, q.matchAny(testSet, null, EmptyStrings).size()); assertEquals(0, q.matchAny(testSet, EmptyStrings, null).size()); }