use of io.crnk.jpa.model.CollectionAttributesTestEntity in project crnk-framework by crnk-project.
the class BasicQueryTestBase method testEqualsInCollectionFilter.
@Test
public void testEqualsInCollectionFilter() {
CollectionAttributesTestEntity entity = new CollectionAttributesTestEntity();
entity.setId(13L);
entity.setLongValues(Arrays.asList(1L, 2L));
entity.setStringValues(Arrays.asList("John", "Doe"));
em.persist(entity);
assertEquals((Long) 13L, queryFactory.query(CollectionAttributesTestEntity.class).addFilter(CollectionAttributesTestEntity.ATTR_stringValues, FilterOperator.EQ, "Doe").buildExecutor().getUniqueResult(false).getId());
assertEquals((Long) 13L, queryFactory.query(CollectionAttributesTestEntity.class).addFilter(CollectionAttributesTestEntity.ATTR_stringValues, FilterOperator.EQ, "John").buildExecutor().getUniqueResult(false).getId());
assertNull(queryFactory.query(CollectionAttributesTestEntity.class).addFilter(CollectionAttributesTestEntity.ATTR_stringValues, FilterOperator.EQ, "Jane").buildExecutor().getUniqueResult(true));
}
Aggregations