use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testUuidNinFilter.
@Test
public void testUuidNinFilter() {
QueryFilter qf = new QueryFilter();
qf.setField("publicId");
qf.setOperation(FilterOperation.NIN);
qf.getValues().add("b3781a0e-fb85-45d1-bd5f-d38802a546d2");
qf.getValues().add("6a749969-9990-4ef0-856a-7e2533b6dc9e");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<Project> projects = JPAUtils.queryEntities(em, Project.class, q);
Assert.assertNotNull(projects);
Assert.assertEquals(0, projects.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testNinic.
@Test
public void testNinic() {
QueryFilter qf = new QueryFilter();
qf.setField("firstname");
qf.setOperation(FilterOperation.NINIC);
qf.getValues().add("sArAH");
qf.getValues().add("ricHArd");
qf.getValues().add("jACk");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
List<User> users = JPAUtils.queryEntities(em, User.class, q);
Assert.assertNotNull(users);
Assert.assertEquals(96, users.size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class JPAUtilsFiltersTest method testEnumNonexistantFilter.
@Test(expected = InvalidFieldValueException.class)
public void testEnumNonexistantFilter() {
QueryFilter qf = new QueryFilter();
qf.setField("status");
qf.setOperation(FilterOperation.EQ);
qf.setValue("NONACTIVE");
QueryParameters q = new QueryParameters();
q.getFilters().add(qf);
JPAUtils.queryEntities(em, Project.class, q);
Assert.fail("No exception was thrown");
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class QueryFilterTest method testFilterConstructorDate.
@Test
public void testFilterConstructorDate() {
Date date = new Date();
QueryFilter filter = new QueryFilter("username", FilterOperation.EQ, date);
Assert.assertNotNull(filter);
Assert.assertEquals("username", filter.getField());
Assert.assertEquals(FilterOperation.EQ, filter.getOperation());
Assert.assertNull(filter.getValue());
Assert.assertEquals(date, filter.getDateValue());
Assert.assertNotNull(filter.getValues());
Assert.assertEquals(0, filter.getValues().size());
}
use of com.github.tfaga.lynx.beans.QueryFilter in project lynx by TFaga.
the class QueryFilterTest method testFilterConstructorEmpty.
@Test
public void testFilterConstructorEmpty() {
QueryFilter filter = new QueryFilter();
Assert.assertNotNull(filter);
Assert.assertNull(filter.getField());
Assert.assertNull(filter.getOperation());
Assert.assertNull(filter.getValue());
Assert.assertNull(filter.getDateValue());
Assert.assertNotNull(filter.getValues());
Assert.assertEquals(0, filter.getValues().size());
}
Aggregations