### Question:
MyEntityController { @GetMapping("/myEntity") @Transactional public List<MyEntityDto> getMyEntities() { var entities = this.myEntityRepository.findAll(); var dtos = StreamSupport.stream(entities.spliterator(), false).map(MyEntityDto::ofMyEntity) .collect(Collectors.toList()); return dtos; } MyEntityController(MyEntityRepository myEntityRepository); @GetMapping("/myEntity") @Transactional List<MyEntityDto> getMyEntities();  }### Answer:
@Test public void testGetMyEntities() throws Exception { var result = mockMvc .perform(MockMvcRequestBuilders .get("/myEntity") ) .andExpect(status().isOk()) .andDo(print()) .andReturn(); var list = objectMapper.readValue(result.getResponse().getContentAsString(), PageWithTotalResponse.class); Assert.assertEquals(6, list.data.size()); Assert.assertEquals(6, list.getTotalElements()); }