use of com.blazebit.persistence.deltaspike.data.testsuite.entity.Person in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindSliceEntity.
@Test
public void testFindSliceEntity() {
Slice<Person> actual = personRepository.findByIdIsNotNull(new PageRequest(0, 1, Sort.Direction.ASC, "id"));
assertEquals(1, actual.getSize());
assertEquals("Mother", actual.getContent().get(0).getName());
actual = personRepository.findByIdIsNotNull(new PageRequest(1, 1, Sort.Direction.ASC, "id"));
assertEquals(1, actual.getSize());
assertEquals("John Doe", actual.getContent().get(0).getName());
}
use of com.blazebit.persistence.deltaspike.data.testsuite.entity.Person in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindBy.
@Test
public void testFindBy() {
List<PersonView> expected = Arrays.asList(fetch(PersonView.class, persons[2].getId()), fetch(PersonView.class, persons[4].getId()));
Person example = new Person();
example.setPosition(4);
// we do not test DeltaSpike's findBy(E, SingularAttribute<E,?>...) method here because its results are non-deterministic
assertEquals(expected, personViewRepository.findBy(example, Person_.position));
}
use of com.blazebit.persistence.deltaspike.data.testsuite.entity.Person in project blaze-persistence by Blazebit.
the class FullEntityViewRepositoryTest method testFindByNameKeysetPaginatedEntity.
@Test
public void testFindByNameKeysetPaginatedEntity() {
// we do not test DeltaSpike's findAll(int, int) method here because its results are non-deterministic
Page<Person> actual = personRepository.findByNameLike("John %", new KeysetPageRequest(null, new PageRequest(0, 1, Sort.Direction.ASC, "id")));
assertTrue(actual instanceof KeysetAwarePage<?>);
assertEquals(1, actual.getNumberOfElements());
assertEquals("John Doe", actual.getContent().get(0).getName());
actual = personRepository.findByNameLike("John %", (KeysetPageable) actual.nextPageable());
assertEquals(1, actual.getNumberOfElements());
assertEquals("John Smith", actual.getContent().get(0).getName());
}
Aggregations