use of example.Address in project elide by yahoo.
the class PersistentResourceTest method testUpdateNullComplexAttributeSuccess.
@Test
public void testUpdateNullComplexAttributeSuccess() {
Company company = newCompany("abc");
company.setAddress(new Address());
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource<Company> parentResource = new PersistentResource<>(company, "1", goodScope);
final Address address = null;
boolean updated = parentResource.updateAttribute("address", address);
assertTrue(updated);
assertNull(company.getAddress(), "The attribute was updated successfully");
goodScope.saveOrCreateObjects();
verify(tx, times(1)).save(company, goodScope);
}
use of example.Address in project elide by yahoo.
the class PersistentResourceTest method testUpdateComplexAttributeAllNullFields.
@Test
public void testUpdateComplexAttributeAllNullFields() {
Company company = newCompany("abc");
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource<Company> parentResource = new PersistentResource<>(company, "1", goodScope);
final Address address = new Address();
address.setStreet1(null);
address.setStreet2(null);
parentResource.updateAttribute("address", address);
assertEquals(address, company.getAddress(), "The attribute was updated successfully");
goodScope.saveOrCreateObjects();
verify(tx, times(1)).save(company, goodScope);
}
use of example.Address in project elide by yahoo.
the class PersistentResourceTest method testUpdateComplexAttributeSuccess.
@Test
public void testUpdateComplexAttributeSuccess() {
Company company = newCompany("abc");
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource<Company> parentResource = new PersistentResource<>(company, "1", goodScope);
final Address address = new Address();
address.setStreet1("street1");
address.setStreet2("street2");
parentResource.updateAttribute("address", address);
assertEquals(address, company.getAddress(), "The attribute was updated successfully");
goodScope.saveOrCreateObjects();
verify(tx, times(1)).save(company, goodScope);
}
use of example.Address in project elide by yahoo.
the class OperatorTest method complexAttributeTest.
@Test
public void complexAttributeTest() throws Exception {
author = new Author();
author.setId(1L);
Address address1 = new Address();
address1.setStreet1("Foo");
author.setHomeAddress(address1);
fn = Operator.IN.contextualize(constructPath(Author.class, "homeAddress.street1"), Arrays.asList("Foo", "Bar"), requestScope);
assertTrue(fn.test(author));
fn = Operator.IN.contextualize(constructPath(Author.class, "homeAddress.street1"), Arrays.asList("Baz"), requestScope);
assertFalse(fn.test(author));
}
use of example.Address in project elide by yahoo.
the class PersistentResourceTest method testUpdateComplexAttributeAllNullFieldsNested.
@Test
public void testUpdateComplexAttributeAllNullFieldsNested() {
Company company = newCompany("abc");
RequestScope goodScope = buildRequestScope(tx, goodUser);
PersistentResource<Company> parentResource = new PersistentResource<>(company, "1", goodScope);
final Address address = new Address();
address.setStreet1(null);
address.setStreet2(null);
final GeoLocation geo = new GeoLocation();
geo.setLatitude("lat");
geo.setLongitude("long");
address.setGeo(geo);
parentResource.updateAttribute("address", address);
assertEquals(address, company.getAddress(), "The attribute was updated successfully");
goodScope.saveOrCreateObjects();
verify(tx, times(1)).save(company, goodScope);
}
Aggregations