}
}
@Test
public void merge() throws Exception {
FieldConfigImpl src = new FieldConfigImpl();
FieldConfigImpl copy;
src.setName("name1");
// groupConfig
copy = mergeField(null, src);
assertEquals("groupCopy", copy.getGroupConfig().getName());
// name
assertEquals("name1", mergeField(null, src).getName());
// displayName
src.setDisplayName("displayName1");
assertEquals("displayName1", mergeField(null, src).getDisplayName());
copy = new FieldConfigImpl();
copy.setDisplayName("displayName2");
assertEquals("displayName2", mergeField(copy, src).getDisplayName());
// defaultValues
src.setDefaultValues(new String[] { "aaa", "bbb", "ccc" });
assertArrayEquals(new String[] { "aaa", "bbb", "ccc" }, mergeField(null, src).getDefaultValues());
copy = new FieldConfigImpl();
copy.setDefaultValues(new String[] { "ddd" });
assertArrayEquals(new String[] { "ddd" }, mergeField(copy, src).getDefaultValues());
// trimming
assertEquals(true, mergeField(null, src).isTrimming());
src.setTrimming(false);
assertEquals(false, mergeField(null, src).isTrimming());
copy = new FieldConfigImpl();
copy.setTrimming(true);
assertEquals(true, mergeField(copy, src).isTrimming());
// propertyName
assertEquals("name1", mergeField(null, src).getPropertyName());
src.setPropertyName("propertyName1");
assertEquals("propertyName1", mergeField(null, src).getPropertyName());
copy = new FieldConfigImpl();
copy.setPropertyName("propertyName2");
assertEquals("propertyName2", mergeField(copy, src).getPropertyName());
// validators
assertArrayEquals(new Object[0], mergeField(null, src).getValidators().toArray());
expect(v1.clone()).andReturn(v3).anyTimes();
v1.init(src);
expectLastCall().anyTimes();
replay(v1);
v3.init(isA(FieldConfig.class));
expectLastCall().anyTimes();
replay(v3);
src.setValidators(createValidatorList(v1));
assertArrayEquals(new Object[] { v3 }, mergeField(null, src).getValidators().toArray());
copy = new FieldConfigImpl();
expect(v2.clone()).andReturn(v4).anyTimes();
v2.init(copy);
expectLastCall().once();
replay(v2);
replay(v4);
copy.setValidators(createValidatorList(v2));
assertArrayEquals(new Object[] { v2, v3 }, mergeField(copy, src).getValidators().toArray());
verify(v1, v2, v3, v4);
}