Ejemplo n.º 1
0
 @Test
 public void testGetAll() throws Exception {
   mockMvc
       .perform(get(REST_URL).contentType(MediaType.APPLICATION_JSON).with(userHttpBasic(USER)))
       .andExpect(status().isOk())
       .andDo(print())
       .andExpect(content().contentType(MediaType.APPLICATION_JSON))
       .andExpect(
           MATCHER_WITH_EXCEED.contentListMatcher(
               UserMealsUtil.getWithExceeded(USER_MEALS, USER.getCaloriesPerDay())));
 }
Ejemplo n.º 2
0
 @Test
 public void testFilterAll() throws Exception {
   mockMvc
       .perform(get(REST_URL + "filter?startDate=&endTime=").with(userHttpBasic(USER)))
       .andExpect(status().isOk())
       .andDo(print())
       .andExpect(
           MATCHER_WITH_EXCEED.contentListMatcher(
               UserMealsUtil.getWithExceeded(
                   Arrays.asList(MEAL6, MEAL5, MEAL4, MEAL3, MEAL2, MEAL1),
                   USER.getCaloriesPerDay())));
 }
Ejemplo n.º 3
0
 @Test
 public void testGetBetween() throws Exception {
   mockMvc
       .perform(
           get(REST_URL + "between?startDateTime=2015-05-30T07:00&endDateTime=2015-05-31T11:00:00")
               .with(userHttpBasic(USER)))
       .andExpect(status().isOk())
       .andDo(print())
       .andExpect(
           MATCHER_WITH_EXCEED.contentListMatcher(
               UserMealsUtil.createWithExceed(MEAL4, true),
               UserMealsUtil.createWithExceed(MEAL1, false)));
 }