@Test
public void testUpdate() throws Exception {

    final URIBuilder uriBuilder = createGetUrl(ROOT_URI + "/" + firstNode.getId());
    JsonObject request = createJson()
            .add("name", "updatedFirstNode")
            .add("description", "updated")
            .add("state", "STOPPED")
            .build();
    // performs PUT: /api/cluster/nodes/1
    mockMvc.perform(put(toUrl(uriBuilder))
            .content(request.toString())
            .contentType(MediaType.APPLICATION_JSON)
            .accept(MediaType.APPLICATION_JSON)
            .with(SecurityMockMvcRequestPostProcessors.authentication(mockAuthentication("ADMIN"))))
            .andExpect(status().isNoContent())
            .andExpect(content().string(isEmptyString()));
    // check updated property
    Node tested = nodeService.getNodeById(firstNode.getId());
    assertThat(tested.getName(), is("updatedFirstNode"));
    assertThat(tested.getDescription(), is("updated"));
    assertThat(tested.getState(), is(NodeState.STOPPED));
}