NgsiValidation { public void checkUpdateContextElement(UpdateContextElement updateContextElement) throws MissingRequestParameterException { if (nullOrEmpty(updateContextElement.getContextAttributes())) { throw new MissingRequestParameterException("contextAttributes", "List<ContextAttribute>"); } }  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 nullAttributesInUpdateContextElement() throws MissingRequestParameterException { UpdateContextElement updateContextElement = new UpdateContextElement(); thrown.expect(MissingRequestParameterException.class); thrown.expectMessage("contextAttributes"); ngsiValidation.checkUpdateContextElement(updateContextElement); }
@Test public void emptyAttributesInUpdateContextElement() throws MissingRequestParameterException { UpdateContextElement updateContextElement = new UpdateContextElement(); updateContextElement.setContextAttributes(Collections.emptyList()); thrown.expect(MissingRequestParameterException.class); thrown.expectMessage("contextAttributes"); ngsiValidation.checkUpdateContextElement(updateContextElement); }