NgsiValidation { public void checkAppendContextElement(AppendContextElement appendContextElement) throws MissingRequestParameterException { if (nullOrEmpty(appendContextElement.getAttributeList())) { 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 nullAttributesInAppendContextElement() throws MissingRequestParameterException { AppendContextElement appendContextElement = new AppendContextElement(); thrown.expect(MissingRequestParameterException.class); thrown.expectMessage("contextAttributes"); ngsiValidation.checkAppendContextElement(appendContextElement); }
@Test public void emptyAttributesInAppendContextElement() throws MissingRequestParameterException { AppendContextElement appendContextElement = new AppendContextElement(); appendContextElement.setAttributeList(Collections.emptyList()); thrown.expect(MissingRequestParameterException.class); thrown.expectMessage("contextAttributes"); ngsiValidation.checkAppendContextElement(appendContextElement); }