Search in sources :

Example 1 with Person

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();
    }
}
Also used : Person(com.orm.androrm.impl.Person)

Example 2 with Person

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());
}
Also used : Filter(com.orm.androrm.Filter) ArrayList(java.util.ArrayList) Person(com.orm.androrm.impl.Person)

Example 3 with Person

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());
}
Also used : Car(com.orm.androrm.impl.Car) Filter(com.orm.androrm.Filter) ArrayList(java.util.ArrayList) Person(com.orm.androrm.impl.Person)

Aggregations

Person (com.orm.androrm.impl.Person)3 Filter (com.orm.androrm.Filter)2 ArrayList (java.util.ArrayList)2 Car (com.orm.androrm.impl.Car)1