public class BeanCopyTest {
@Test
public void testCopy() {
FooBean fb = createFooBean();
FooBean dest = new FooBean();
BeanCopy.beans(fb, dest).copy();
Integer v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
assertEquals(201, v.intValue());
v = (Integer) BeanUtil.getProperty(dest, "fooint");
assertEquals(202, v.intValue());
Long vl = (Long) BeanUtil.getProperty(dest, "fooLong");
assertEquals(203, vl.longValue());
vl = (Long) BeanUtil.getProperty(dest, "foolong");
assertEquals(204, vl.longValue());
Byte vb = (Byte) BeanUtil.getProperty(dest, "fooByte");
assertEquals(95, vb.intValue());
vb = (Byte) BeanUtil.getProperty(dest, "foobyte");
assertEquals(96, vb.intValue());
Character c = (Character) BeanUtil.getProperty(dest, "fooCharacter");
assertEquals('7', c.charValue());
c = (Character) BeanUtil.getProperty(dest, "foochar");
assertEquals('8', c.charValue());
Boolean b = (Boolean) BeanUtil.getProperty(dest, "fooBoolean");
assertTrue(b.booleanValue());
b = (Boolean) BeanUtil.getProperty(dest, "fooboolean");
assertFalse(b.booleanValue());
Float f = (Float) BeanUtil.getProperty(dest, "fooFloat");
assertEquals(209.0, f.floatValue(), 0.005);
f = (Float) BeanUtil.getProperty(dest, "foofloat");
assertEquals(210.0, f.floatValue(), 0.005);
Double d = (Double) BeanUtil.getProperty(dest, "fooDouble");
assertEquals(211.0, d.doubleValue(), 0.005);
d = (Double) BeanUtil.getProperty(dest, "foodouble");
assertEquals(212.0, d.doubleValue(), 0.005);
String s = (String) BeanUtil.getProperty(dest, "fooString");
assertEquals("213", s);
String[] sa = (String[]) BeanUtil.getProperty(dest, "fooStringA");
assertEquals(2, sa.length);
assertEquals("214", sa[0]);
assertEquals("215", sa[1]);
assertSame(dest.getFooStringA(), sa);
FooBean empty = new FooBean();
BeanCopy.beans(empty, dest).copy();
v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
assertNull(v);
v = (Integer) BeanUtil.getProperty(dest, "fooint");