@Test
public void testDelete() throws Exception {

    final URIBuilder uriBuilder = createGetUrl(ROOT_URI + "/" + firstNode.getId());
    // performs PUT: /api/cluster/nodes/1
    mockMvc.perform(delete(toUrl(uriBuilder))
            .contentType(MediaType.APPLICATION_JSON)
            .accept(MediaType.APPLICATION_JSON)
            .with(SecurityMockMvcRequestPostProcessors.authentication(mockAuthentication("ADMIN"))))
            .andExpect(status().isNoContent());
    try {
        nodeService.getNodeById(firstNode.getNodeId());
        fail("Node cannot not exist");
    } catch (Exception e) {
        assertThat(e, instanceOf(NoDataFoundException.class));
    }
}