NotificationSubscriptionContextFactory { public Long getSubContextIdFrom(String subidentifier) { String subidentifierDelimiter = ":"; if (subidentifier.contains(subidentifierDelimiter)) { subidentifier = subidentifier.substring(0, subidentifier.indexOf(subidentifierDelimiter)); } return Long.valueOf(subidentifier); }  NotificationSubscriptionContext createNotificationSubscriptionContext(Identity identity, SubscriptionContext subscriptionContext, PublisherData publisherData); Long getSubContextIdFrom(String subidentifier); ContextInfo createContextInfoFrom(SubscriptionContext subsContext);  }
@Test public void getSubContextIdFrom() { String subidentifier = "12345"; Long subContextId = notificationSubscriptionContextFactoryTestObject.getSubContextIdFrom(subidentifier); assertEquals("Could not extract subContextId from '" + subidentifier + "'", Long.valueOf(subidentifier), subContextId); }
@Test public void getSubContextIdFrom_WithDelimiter() { String subContextIdString = "12345"; String subidentifier = subContextIdString + ":456"; Long subContextId = notificationSubscriptionContextFactoryTestObject.getSubContextIdFrom(subidentifier); assertEquals("Could not extract subContextId from '" + subidentifier + "'", Long.valueOf(subContextIdString), subContextId); }