Added tests suite used by Roger Light to check SubscriptionStore.matchTopics

This commit is contained in:
andrea
2013-11-06 13:37:23 +01:00
parent 2c18ee92c7
commit 49d1b2c948
2 changed files with 33 additions and 2 deletions
@@ -301,7 +301,29 @@ public class SubscriptionsStoreTest {
assertTrue(SubscriptionsStore.matchTopics("/finance/stock/ibm", "/finance/+/ibm"));
assertFalse(SubscriptionsStore.matchTopics("/finance/stock", "+"));
}
@Test
public void rogerLightMatchTopics() {
assertTrue(SubscriptionsStore.matchTopics("foo/bar", "foo/bar"));
assertTrue(SubscriptionsStore.matchTopics("foo/bar", "foo/+"));
assertTrue(SubscriptionsStore.matchTopics("foo/bar/baz", "foo/+/baz"));
assertTrue(SubscriptionsStore.matchTopics("foo/bar/baz", "foo/+/#"));
assertTrue(SubscriptionsStore.matchTopics("foo/bar/baz", "#"));
assertFalse(SubscriptionsStore.matchTopics("foo", "foo/bar"));
assertFalse(SubscriptionsStore.matchTopics("foo/bar/baz", "foo/+"));
assertFalse(SubscriptionsStore.matchTopics("foo/bar/bar", "foo/+/baz"));
assertFalse(SubscriptionsStore.matchTopics("fo2/bar/baz", "foo/+/#"));
assertTrue(SubscriptionsStore.matchTopics("/foo/bar", "#"));
assertTrue(SubscriptionsStore.matchTopics("/foo/bar", "/#"));
assertFalse(SubscriptionsStore.matchTopics("foo/bar", "/#"));
assertTrue(SubscriptionsStore.matchTopics("foo//bar", "foo//bar"));
assertTrue(SubscriptionsStore.matchTopics("foo//bar", "foo//+"));
assertTrue(SubscriptionsStore.matchTopics("foo///baz", "foo/+/+/baz"));
assertTrue(SubscriptionsStore.matchTopics("foo/bar/", "foo/bar/+"));
}
private static Token[] asArray(Object... l) {
Token[] tokens = new Token[l.length];