@Test // map null wrapper object to string. expectation: string should be null public void testB2AwithNullWrapper() { B b = new B(); b.code = null; A a = mapper.map(b, A.class); Assert.assertNotNull(a); Assert.assertNull(a.code); }
@Test // map wrapper object to string. expectation: string should contain content of wrapper object public void testB2AwithValue() { B b = new B(); b.code = new WrapperObject(); b.code.setId("x"); A a = mapper.map(b, A.class); Assert.assertNotNull(a); Assert.assertEquals(b.code.getId(), a.code); }
@Test // map wrapper object with null content to string. expectation: string should be null public void testB2AwithNullValue() { B b = new B(); b.code = new WrapperObject(); b.code.setId(null); A a = mapper.map(b, A.class); Assert.assertNotNull(a); Assert.assertNull(a.code); }
@Test // map null string to wrapper object. expectation: wrapper object should be null public void testA2BwithNullValue() { B b = new B(); b.code = new WrapperObject(); b.code.setId(null); A a = mapper.map(b, A.class); Assert.assertNotNull(a); Assert.assertNull(a.code); }