@Test
public void findBySearchTerm_NoTodoEntriesFound_ShouldReturnAnEmptyPageAsJsonDocument() throws Exception {

    Page<TodoDTO> searchResults = new PageBuilder<TodoDTO>()
            .pageNumber(PAGE_NUMBER)
            .pageSize(PAGE_SIZE)
            .totalNumberOfItems(ZERO_ITEMS_FOUND)
            .build();
    when(todoSearchServiceMock.findBySearchTerm(eq(SEARCH_TERM), isA(Pageable.class))).thenReturn(searchResults);
    mockMvc.perform(get("/api/todo/search")
            .param(WebTestConstants.REQUEST_PARAM_SEARCH_TERM, SEARCH_TERM)
            .param(WebTestConstants.REQUEST_PARAM_PAGE_NUMBER, PAGE_NUMBER_STRING)
            .param(WebTestConstants.REQUEST_PARAM_PAGE_SIZE, PAGE_SIZE_STRING)
            .param(WebTestConstants.REQUEST_PARAM_SORT, WebTestUtil.createSortParameterValue(SORT_FIELD, SORT_ORDER))
    )
            .andExpect(status().isOk())
            .andExpect(content().contentType(WebTestConstants.APPLICATION_JSON_UTF8))
            .andExpect(jsonPath("$.number", is(PAGE_NUMBER)))
            .andExpect(jsonPath("$.size", is(PAGE_SIZE)))
            .andExpect(jsonPath("$.numberOfElements", is(ZERO_ITEMS_FOUND)))
            .andExpect(jsonPath("$.firstPage", is(true)))
            .andExpect(jsonPath("$.lastPage", is(true)))
            .andExpect(jsonPath("$.totalPages", is(ZERO_PAGES_FOUND)))
            .andExpect(jsonPath("$.totalElements", is(ZERO_ITEMS_FOUND)))
            .andExpect(jsonPath("$.content", hasSize(0)))
            .andDo(print());
    ArgumentCaptor<Pageable> pageableArgument = ArgumentCaptor.forClass(Pageable.class);
    verify(todoSearchServiceMock, times(1)).findBySearchTerm(eq(SEARCH_TERM), pageableArgument.capture());
    verifyNoMoreInteractions(todoSearchServiceMock);
    verifyZeroInteractions(todoCrudServiceMock);
    Pageable pageSpecification = pageableArgument.getValue();
    assertThat(pageSpecification.getPageNumber()).isEqualTo(PAGE_NUMBER);
    assertThat(pageSpecification.getPageSize()).isEqualTo(PAGE_SIZE);
    Sort sortSpecification = pageSpecification.getSort();
    assertThat(sortSpecification.getOrderFor(SORT_FIELD).getDirection()).isEqualTo(Sort.Direction.fromString(SORT_ORDER));
}