Search in sources :

Example 1 with Phone

use of io.requery.test.autovalue.Phone in project requery by requery.

the class AutoValueModelTest method testInsertReference.

@Test
public void testInsertReference() {
    randomPerson();
    Result<Person> result = data.select(Person.class).get();
    Person person = result.first();
    int id = data.insert(Phone.class).value(PhoneType.PHONE_NUMBER, "5555555").value(PhoneType.NORMALIZED, false).value(PhoneType.OWNER_ID, person.getId()).get().first().get(PhoneType.ID);
    assertTrue(id != 0);
    Phone phone = data.select(Phone.class).get().first();
    assertSame(phone.getOwnerId(), person.getId());
}
Also used : Phone(io.requery.test.autovalue.Phone) Person(io.requery.test.autovalue.Person) Test(org.junit.Test)

Aggregations

Person (io.requery.test.autovalue.Person)1 Phone (io.requery.test.autovalue.Phone)1 Test (org.junit.Test)1