use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script14.
@Test
public void script14() throws EntityFinderException {
Male person = templateFor(Male.class);
// should return Joe Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Male.class, isNull(person.wife()), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JOE);
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script11.
@Test
public void script11() throws EntityFinderException {
Person person = templateFor(Person.class);
// should return Joe Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Person.class, isNotNull(person.email()), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JOE);
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script19.
@Test
public void script19() throws EntityFinderException {
// should return all Nameable entities with a name > "B" sorted by name
Nameable nameable = templateFor(Nameable.class);
List<String> largerThanB = new ArrayList<>();
for (String name : NameableAssert.allNames()) {
if (name.compareTo("B") > 0) {
largerThanB.add(name);
}
}
Collections.sort(largerThanB);
Iterable<EntityReference> entities = entityFinder.findEntities(Nameable.class, gt(nameable.name(), "B"), new OrderBy[] { orderBy(nameable.name()) }, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(false, entities, largerThanB.toArray(new String[largerThanB.size()]));
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script05.
@Test
public void script05() throws EntityFinderException {
Person person = templateFor(Person.class);
// should return Joe Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Person.class, eq(person.mother().get().placeOfBirth().get().name(), "Kuala Lumpur"), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JOE);
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script09.
@Test
@SuppressWarnings("unchecked")
public void script09() throws EntityFinderException {
Person person = templateFor(Person.class);
// should return Ann Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Female.class, or(eq(person.yearOfBirth(), 1970), eq(person.yearOfBirth(), 1975)), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, ANN);
}
Aggregations