Examples of AnotherTestObject


Examples of org.dozer.vo.AnotherTestObject

  }

  @Test
  public void testNullToPrimitive() throws Exception {
    mapper = getMapper(new String[] { "dozerBeanMapping.xml" });
    AnotherTestObject src = newInstance(AnotherTestObject.class);
    AnotherTestObjectPrime prime = newInstance(AnotherTestObjectPrime.class);
    TestObject to = newInstance(TestObject.class);
    to.setThePrimitive(AnotherTestObjectPrime.DEFAULT_FIELD1);
    prime.setTo(to);
    mapper.map(src, prime);
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

    srcNestedObj2.setSimpleObjects(new SimpleObj[] { simpleObj, newInstance(SimpleObj.class) });

    SrcNestedDeepObj srcNestedObj = newInstance(SrcNestedDeepObj.class);
    srcNestedObj.setSrcNestedObj2(srcNestedObj2);

    AnotherTestObject anotherTestObject = newInstance(AnotherTestObject.class);
    anotherTestObject.setField3("another test object field 3 value");
    anotherTestObject.setField4("6453");

    TestObject testObject1 = newInstance(TestObject.class);
    TestObject testObject2 = newInstance(TestObject.class);
    testObject2.setEqualNamedList(Arrays.asList(new AnotherTestObject[] { anotherTestObject }));
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

    srcNestedObj2.setSimpleObjects(new SimpleObj[] { simpleObj, newInstance(SimpleObj.class) });

    SrcNestedDeepObj srcNestedObj = newInstance(SrcNestedDeepObj.class);
    srcNestedObj.setSrcNestedObj2(srcNestedObj2);

    AnotherTestObject anotherTestObject = newInstance(AnotherTestObject.class);
    anotherTestObject.setField3("another test object field 3 value");
    anotherTestObject.setField4("6453");

    TestObject testObject1 = newInstance(TestObject.class);
    TestObject testObject2 = newInstance(TestObject.class);
    testObject2.setEqualNamedList(Arrays.asList(new AnotherTestObject[] { anotherTestObject }));
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

  @Test
  public void testMapNull_MappingLevel() throws Exception {
    Mapper mapper = getMapper("nullFieldMapping.xml");
    // check that null does not override an existing value when map-null="false"
    AnotherTestObject src = newInstance(AnotherTestObject.class);
    src.setField3(null);
    src.setField4(null);
    AnotherTestObjectPrime dest = newInstance(AnotherTestObjectPrime.class);
    dest.setTo(newInstance(TestObject.class));
    dest.setField3("555");
    dest.getTo().setOne("4641");
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

    // Reverse mapping
    AnotherTestObjectPrime src = newInstance(AnotherTestObjectPrime.class);
    src.setTo(newInstance(TestObject.class));
    src.setField3(null);
    src.getTo().setOne(null);
    AnotherTestObject dest = newInstance(AnotherTestObject.class);
    dest.setField3("555");
    dest.setField4("4641");

    // dest field should remain unchanged
    mapper.map(src, dest);
    assertEquals("invalid dest field value", "555", dest.getField3());
    assertEquals("invalid dest field value2", "4641", dest.getField4());
  }
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

  @Test
  public void testMapEmptyString_MappingLevel() throws Exception {
    Mapper mapper = getMapper("nullFieldMapping.xml");
    // check that "" does not override an existing value when
    // map-empty-string="false"
    AnotherTestObject src = newInstance(AnotherTestObject.class);
    src.setField3("");
    src.setField4("");
    AnotherTestObjectPrime dest = newInstance(AnotherTestObjectPrime.class);
    dest.setTo(newInstance(TestObject.class));
    dest.setField3("555");
    dest.getTo().setOne("4641");
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

    // reverse mapping
    AnotherTestObjectPrime src = newInstance(AnotherTestObjectPrime.class);
    src.setTo(newInstance(TestObject.class));
    src.setField3("");
    src.getTo().setOne("");
    AnotherTestObject dest = newInstance(AnotherTestObject.class);
    dest.setField3("555");
    dest.setField4("4641");

    // dest field should remain unchanged
    mapper.map(src, dest);
    assertEquals("invalid dest field value", "555", dest.getField3());
    assertEquals("invalid dest field value2", "4641", dest.getField4());
  }
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

  }

  @Test
  public void testNullField() throws Exception {
    mapper = getMapper("dozerBeanMapping.xml");
    AnotherTestObject src = newInstance(AnotherTestObject.class);
    src.setField2(null);
    AnotherTestObjectPrime dest = newInstance(AnotherTestObjectPrime.class);
    dest.setField2(Integer.valueOf("555"));
    // check that null overrides an existing value
    mapper.map(src, dest);
    assertNull("dest field should be null", dest.getField2());
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

  }

  @Test
  public void testNullToPrimitive() throws Exception {
    mapper = getMapper("dozerBeanMapping.xml");
    AnotherTestObject src = newInstance(AnotherTestObject.class);
    AnotherTestObjectPrime prime = newInstance(AnotherTestObjectPrime.class);
    TestObject to = newInstance(TestObject.class);
    to.setThePrimitive(AnotherTestObjectPrime.DEFAULT_FIELD1);
    prime.setTo(to);
    mapper.map(src, prime);
View Full Code Here

Examples of org.dozer.vo.AnotherTestObject

  @Test
  public void testSimpleCustomConverter() throws Exception {
    SimpleObj src = newInstance(SimpleObj.class);
    src.setField1(String.valueOf(System.currentTimeMillis()));

    AnotherTestObject dest = mapper.map(src, AnotherTestObject.class);

    // Custom converter specified for the field1 mapping, so verify custom converter was actually used
    assertNotNull("dest field1 should not be null", dest.getField3());
    StringTokenizer st = new StringTokenizer(dest.getField3(), "-");
    assertEquals("dest field1 value should contain a hyphon", 2, st.countTokens());
    String token1 = st.nextToken();
    assertEquals("1st portion of dest field1 value should equal src field value", src.getField1(), token1);
    String token2 = st.nextToken();
    assertEquals("custom converter param should have been appended to by the cust converter", "CustomConverterParamTest", token2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.