NgsiValidation { public void checkUnsubscribeContext(UnsubscribeContext unsubscribeContext) throws MissingRequestParameterException { if (nullOrEmpty(unsubscribeContext.getSubscriptionId())){ throw new MissingRequestParameterException("subscriptionId", "String"); } }  void checkUpdateContext(UpdateContext updateContext); void checkNotifyContext(NotifyContext notifyContext); void checkRegisterContext(RegisterContext registerContext); void checkSubscribeContext(SubscribeContext subscribeContext); void checkUpdateContextSubscription(UpdateContextSubscription updateContextSubscription); void checkUnsubscribeContext(UnsubscribeContext unsubscribeContext); void checkQueryContext(QueryContext queryContext); void checkAppendContextElement(AppendContextElement appendContextElement); void checkUpdateContextElement(UpdateContextElement updateContextElement); void checkUpdateContextAttribute(String entityID, String attributeName, String valueID, UpdateContextAttribute updateContextAttribute); void checkUpdateSubscription(String subscriptionID, UpdateContextSubscription updateContextSubscription);  }
@Test public void nullSubscriptionIdInUnSubscribeContext() throws MissingRequestParameterException { UnsubscribeContext unsubscribeContext = new UnsubscribeContext(); thrown.expect(MissingRequestParameterException.class); thrown.expectMessage("subscriptionId"); ngsiValidation.checkUnsubscribeContext(unsubscribeContext); }
@Test public void emptySubscriptionIdInUnSubscribeContext() throws MissingRequestParameterException { UnsubscribeContext unsubscribeContext = new UnsubscribeContext(); unsubscribeContext.setSubscriptionId(""); thrown.expect(MissingRequestParameterException.class); thrown.expectMessage("subscriptionId"); ngsiValidation.checkUnsubscribeContext(unsubscribeContext); }