use of io.requery.test.model.Address in project requery by requery.
the class FunctionalTest method testGetNullAssociationInverse.
@Test
public void testGetNullAssociationInverse() {
Address address = randomAddress();
data.insert(address);
assertNull(address.getPerson());
}
use of io.requery.test.model.Address in project requery by requery.
the class FunctionalTest method testCopy.
@Test
public void testCopy() {
Address address = new Address();
address.setCity("San Francisco");
address.setState("CA");
address.setCountry("US");
Address copy = address.copy();
assertEquals(address.getCity(), copy.getCity());
assertEquals(address.getState(), copy.getState());
assertEquals(address.getCountry(), copy.getCountry());
}
use of io.requery.test.model.Address in project requery by requery.
the class FunctionalTest method testInsertOneToOne.
@Test
public void testInsertOneToOne() {
Address address = randomAddress();
data.insert(address);
assertTrue(address.getId() > 0);
Person person = randomPerson();
data.insert(person);
person.setAddress(address);
data.update(person);
// fetch inverse
assertSame(address.getPerson(), person);
// unset
person.setAddress(null);
}
use of io.requery.test.model.Address in project requery by requery.
the class FunctionalTest method testDeleteCascadeOneToOne.
@Test
public void testDeleteCascadeOneToOne() {
Address address = randomAddress();
data.insert(address);
int id = address.getId();
assertTrue(id > 0);
Person person = randomPerson();
person.setAddress(address);
data.insert(person);
data.delete(person);
assertNull(address.getPerson());
assertNull(data.findByKey(Address.class, id));
}
use of io.requery.test.model.Address in project requery by requery.
the class FunctionalTest method testInsertOneToOneCascade.
@Test
public void testInsertOneToOneCascade() {
Address address = randomAddress();
Person person = randomPerson();
person.setAddress(address);
data.insert(person);
// fetch inverse
assertSame(address.getPerson(), person);
}
Aggregations