NgsiRestClient extends NgsiClient { public ListenableFuture<StatusCode> appendContextAttribute(String url, HttpHeaders httpHeaders, String entityID, String attributeName, UpdateContextAttribute updateContextAttribute) { return request(HttpMethod.POST, url + entitiesPath + entityID + attributesPath + attributeName, httpHeaders, updateContextAttribute, StatusCode.class); }  ListenableFuture<AppendContextElementResponse> appendContextElement(String url, HttpHeaders httpHeaders, String entityID, AppendContextElement appendContextElement); ListenableFuture<UpdateContextElementResponse> updateContextElement(String url, HttpHeaders httpHeaders, String entityID, UpdateContextElement updateContextElement); ListenableFuture<ContextElementResponse> getContextElement(String url, HttpHeaders httpHeaders, String entityID); ListenableFuture<StatusCode> deleteContextElement(String url, HttpHeaders httpHeaders, String entityID); ListenableFuture<StatusCode> appendContextAttribute(String url, HttpHeaders httpHeaders, String entityID, String attributeName, UpdateContextAttribute updateContextAttribute); ListenableFuture<StatusCode> updateContextAttribute(String url, HttpHeaders httpHeaders, String entityID, String attributeName, UpdateContextAttribute updateContextAttribute); ListenableFuture<ContextAttributeResponse> getContextAttribute(String url, HttpHeaders httpHeaders, String entityID, String attributeName); ListenableFuture<StatusCode> deleteContextAttribute(String url, HttpHeaders httpHeaders, String entityID, String attributeName); ListenableFuture<StatusCode> updateContextAttributeValue(String url, HttpHeaders httpHeaders, String entityID, String attributeName, String valueID, UpdateContextAttribute updateContextAttribute); ListenableFuture<ContextAttributeResponse> getContextAttributeValue(String url, HttpHeaders httpHeaders, String entityID, String attributeName, String valueID); ListenableFuture<StatusCode> deleteContextAttributeValue(String url, HttpHeaders httpHeaders, String entityID, String attributeName, String valueID); ListenableFuture<QueryContextResponse> getContextEntityType(String url, HttpHeaders httpHeaders, String typeName); ListenableFuture<QueryContextResponse> getContextEntityTypeAttribute(String url, HttpHeaders httpHeaders, String typeName, String attributeName); ListenableFuture<SubscribeContextResponse> appendContextSubscription(String url, HttpHeaders httpHeaders, SubscribeContext subscribeContext); ListenableFuture<UpdateContextSubscriptionResponse> updateContextSubscription(String url, HttpHeaders httpHeaders, String subscriptionID, UpdateContextSubscription updateContextSubscription); ListenableFuture<UnsubscribeContextResponse> deleteContextSubscription(String url, HttpHeaders httpHeaders, String subscriptionID);  }
@Test public void testAppendContextAttribute_JSON() throws Exception { String responseBody = json(jsonConverter, new StatusCode(CodeEnum.CODE_200)); mockServer.expect(requestTo(baseUrl+"/ngsi10/contextEntities/123/attributes/temp")) .andExpect(method(HttpMethod.POST)) .andExpect(jsonPath("$.name").value("temp")) .andExpect(jsonPath("$.type").value("float")) .andExpect(jsonPath("$.value").value("15.5")) .andRespond(withSuccess(responseBody, MediaType.APPLICATION_JSON)); StatusCode response = ngsiRestClient.appendContextAttribute(baseUrl, null, "123", "temp", Util.createUpdateContextAttributeTemperature()).get(); this.mockServer.verify(); assertEquals(CodeEnum.CODE_200.getLabel(), response.getCode()); }