* to be tested as well.
*/
public void testSettersWithCollections() {
SimpleFooRequest context = simpleFooRequest();
SimpleFooProxy foo = context.create(SimpleFooProxy.class);
SimpleBarProxy bar = context.create(SimpleBarProxy.class);
List<SimpleBarProxy> originalList = Collections.singletonList(bar);
// Assert that uninitalize references are null
assertNull(foo.getOneToManyField());
// Assert that objects are mutable after creation
foo.setOneToManyField(null);
assertSame(foo, context.edit(foo));
foo.setOneToManyField(originalList);
// There's a "dummy" create case here; AbstractRequest, DVS is untestable
// Quick sanity check on the behavior
List<SimpleBarProxy> list = foo.getOneToManyField();
assertNotSame(originalList, list);
assertEquals(originalList, list);
assertEquals(1, list.size());
assertEquals(bar.stableId(), list.get(0).stableId());
assertEquals(list, foo.getOneToManyField());
// Assert that entities returned from editable list are mutable
list.get(0).setUserName("userName");
}