@Test public void testDelete() throws Exception { mockMvc .perform( delete(REST_URL + MEAL1_ID) .contentType(MediaType.APPLICATION_JSON) .with(userHttpBasic(USER))) .andExpect(status().isOk()); MATCHER.assertCollectionEquals( Arrays.asList(MEAL6, MEAL5, MEAL4, MEAL3, MEAL2), service.getAll(START_SEQ)); }
@Test public void testCreate() throws Exception { UserMeal created = getCreated(); ResultActions action = mockMvc.perform( post(REST_URL) .contentType(MediaType.APPLICATION_JSON) .content(JsonUtil.writeValue(created)) .with(userHttpBasic(ADMIN))); UserMeal returned = MATCHER.fromJsonAction(action); created.setId(returned.getId()); MATCHER.assertEquals(created, returned); MATCHER.assertCollectionEquals( Arrays.asList(ADMIN_MEAL2, created, ADMIN_MEAL), service.getAll(ADMIN_ID)); }