@Test public void getSourceIdFrom() { String sourceId = "82817051271953"; String data = "/course/85196901216965/foldernodes/" + sourceId; Long extractedSourceId = notificationSubscriptionContextFactoryTestObject.getSourceIdFrom(data); assertEquals("Could not extract sourceId from '" + data + "'", Long.valueOf(sourceId), extractedSourceId); }
Long getSourceIdFrom(String data) { if (data.indexOf(FOLDERS_PREFIX) > 0) { data = data.substring(data.indexOf(FOLDERS_PREFIX) + FOLDERS_PREFIX.length() + 1); } return Long.valueOf(data); }
NotificationSubscriptionContextFactory { Long getSourceIdFrom(String data) { if (data.indexOf(FOLDERS_PREFIX) > 0) { data = data.substring(data.indexOf(FOLDERS_PREFIX) + FOLDERS_PREFIX.length() + 1); } return Long.valueOf(data); } }
NotificationSubscriptionContextFactory { Long getSourceIdFrom(String data) { if (data.indexOf(FOLDERS_PREFIX) > 0) { data = data.substring(data.indexOf(FOLDERS_PREFIX) + FOLDERS_PREFIX.length() + 1); } return Long.valueOf(data); }  }
NotificationSubscriptionContextFactory { Long getSourceIdFrom(String data) { if (data.indexOf(FOLDERS_PREFIX) > 0) { data = data.substring(data.indexOf(FOLDERS_PREFIX) + FOLDERS_PREFIX.length() + 1); } return Long.valueOf(data); }  NotificationSubscriptionContext createNotificationSubscriptionContext(Identity identity, SubscriptionContext subscriptionContext, PublisherData publisherData); Long getSubContextIdFrom(String subidentifier); ContextInfo createContextInfoFrom(SubscriptionContext subsContext); }
NotificationSubscriptionContextFactory { Long getSourceIdFrom(String data) { if (data.indexOf(FOLDERS_PREFIX) > 0) { data = data.substring(data.indexOf(FOLDERS_PREFIX) + FOLDERS_PREFIX.length() + 1); } return Long.valueOf(data); }  NotificationSubscriptionContext createNotificationSubscriptionContext(Identity identity, SubscriptionContext subscriptionContext, PublisherData publisherData); Long getSubContextIdFrom(String subidentifier); ContextInfo createContextInfoFrom(SubscriptionContext subsContext);  }