use of org.summerb.approaches.jdbccrud.api.dto.PagerParams in project summerb by skarpushin.
the class UserDaoImplTest method testFindUsersByDisplayNamePartial_expectCorrectSorting.
@Test
public // @Rollback(false)
void testFindUsersByDisplayNamePartial_expectCorrectSorting() throws Exception {
User user = UserFactory.createNewUserTemplate();
user.setDisplayName("ooUHapqoiwez");
user.setEmail("email2@aaa.ru");
userService.createUser(user);
user = UserFactory.createNewUserTemplate();
user.setDisplayName("oooUHapqoiwez");
user.setEmail("email3@aaa.ru");
userService.createUser(user);
user = UserFactory.createNewUserTemplate();
user.setDisplayName("oUHapqoiwez");
user.setEmail("email1@aaa.ru");
userService.createUser(user);
PaginatedList<User> results = userService.findUsersByDisplayNamePartial("UHapqoiwez", new PagerParams());
assertNotNull(results);
List<User> items = results.getItems();
assertNotNull(items);
assertTrue(items.size() == 3);
assertTrue(results.getTotalResults() == 3);
assertEquals("email1@aaa.ru", items.get(0).getEmail());
assertEquals("email2@aaa.ru", items.get(1).getEmail());
assertEquals("email3@aaa.ru", items.get(2).getEmail());
}
use of org.summerb.approaches.jdbccrud.api.dto.PagerParams in project summerb by skarpushin.
the class GenericCrudServiceTestTemplate method testFindByQueryBetween.
@Test
public void testFindByQueryBetween() throws Exception {
createTestData();
PaginatedList<TestDto1> result = getTestDto1Service().query(new PagerParams(0, 100), Query.n().between("minorVersion", 4, 5));
assertEquals(2, result.getTotalResults());
}
use of org.summerb.approaches.jdbccrud.api.dto.PagerParams in project summerb by skarpushin.
the class GenericCrudServiceTestTemplate method testFindByQueryContains.
@Test
public void testFindByQueryContains() throws Exception {
createTestData();
PaginatedList<TestDto1> result = getTestDto1Service().query(new PagerParams(0, 100), Query.n().contains("env", "env-p"));
assertEquals(2, result.getTotalResults());
}
use of org.summerb.approaches.jdbccrud.api.dto.PagerParams in project summerb by skarpushin.
the class GenericCrudServiceTestTemplate method testFindByQueryIsNotNull.
@Test
public void testFindByQueryIsNotNull() throws Exception {
createTestData();
PaginatedList<TestDto1> result = getTestDto1Service().query(new PagerParams(0, 100), Query.n().isNotNull("linkToPatchToNextVersion"));
assertEquals(1, result.getTotalResults());
}
use of org.summerb.approaches.jdbccrud.api.dto.PagerParams in project summerb by skarpushin.
the class GenericCrudServiceTestTemplate method testQuery_expectPaginationWorksCorrectly.
@Test
public void testQuery_expectPaginationWorksCorrectly() throws Exception {
createTestData();
PaginatedList<TestDto1> result = getTestDto1Service().query(new PagerParams(0, 2), Query.n().contains("env", "env-"));
assertEquals(3, result.getTotalResults());
assertEquals(2, result.getItems().size());
}
Aggregations