Exemplo n.º 1
0
  @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);
  }
Exemplo n.º 2
0
  @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);
  }
Exemplo n.º 3
0
  @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);
  }
Exemplo n.º 4
0
  @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);
  }