@Test
public void should_add_a_property_to_a_widget_and_return_the_list_of_properties() throws Exception {

    Property property = aProperty().build();
    List<Property> expectedProperties = asList(property);
    when(widgetRepository.addProperty("customLabel", property)).thenReturn(expectedProperties);
    mockMvc.perform(post("/rest/widgets/customLabel/properties")
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .content(convertObjectToJsonBytes(property)))
            .andExpect(status().isOk())
            .andExpect(content().json(toJson(expectedProperties)));
    verify(widgetRepository).addProperty("customLabel", property);
}