@Test
public void should_create_a_new_widget() throws Exception {

    Widget customLabel = aWidget().name("label").custom().build();
    when(widgetRepository.create(customLabel)).thenReturn(customLabel);
    mockMvc
            .perform(post("/rest/widgets")
                    .contentType(MediaType.APPLICATION_JSON_VALUE)
                    .content(convertObjectToJsonBytes(customLabel)))
            .andExpect(status().isOk());
    verify(widgetRepository).create(notNull(Widget.class));
}