use of com.orm.androrm.impl.Person in project androrm by androrm.
the class ForeignKeyRegression method testKeyNull.
public void testKeyNull() {
Person person = new Person();
person.setName("Paul");
try {
person.save(getContext());
} catch (NullPointerException e) {
fail();
}
}
use of com.orm.androrm.impl.Person in project androrm by androrm.
the class FilterTest method testInFilterString.
public void testInFilterString() {
Person tom = new Person();
tom.setName("tom");
tom.save(getContext());
Person peter = new Person();
peter.setName("peter");
peter.save(getContext());
Person susan = new Person();
susan.setName("susan");
susan.save(getContext());
List<String> names = new ArrayList<String>();
names.add("tom");
names.add("peter");
Filter filter = new Filter();
filter.in("mName", names);
QuerySet<Person> people = Person.objects(getContext()).filter(filter);
assertEquals(2, people.count());
}
use of com.orm.androrm.impl.Person in project androrm by androrm.
the class FilterTest method testInFilterModel.
public void testInFilterModel() {
Person p = new Person();
p.setName("tom");
p.save(getContext());
Car c = new Car();
c.addDriver(p);
c.setName("Toyota");
c.save(getContext());
List<Person> drivers = new ArrayList<Person>();
drivers.add(p);
Filter filter = new Filter();
filter.in("mDrivers", drivers);
QuerySet<Car> cars = Car.objects(getContext()).filter(filter);
assertEquals(1, cars.count());
}