@Test
void shouldListSortedData() {

    PetEntity petEntity1 = new PetEntity();
    petEntity1.setName("browny");
    petEntity1.setOwner("dodong");
    PetEntity petEntity2 = new PetEntity();
    petEntity2.setName("asol");
    petEntity2.setOwner("gerry");
    when(queryService.getTypedQuery(PetEntity.class, Sort.by("name"), entityManager)).thenReturn(query);
    when(query.getResultList()).thenReturn(List.of(petEntity2, petEntity1));
    List<PetEntity> result = target.findAll(Sort.by("name"));
    assertThat(result.size(), is(2));
    assertThat(result.get(0).getName(), is("asol"));
}