@Test
public void should_respond_404_when_adding_a_property_to_an_unexisting_widget() throws Exception {

    when(widgetRepository.addProperty(eq("unknownWidget"), any(Property.class))).thenThrow(new NotFoundException("not found"));
    mockMvc.perform(post("/rest/widgets/unknownWidget/properties")
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .content(convertObjectToJsonBytes(aProperty().build())))
            .andExpect(status().isNotFound());
}