Package org.dozer.vo

Examples of org.dozer.vo.TestObject


  @Test
  public void testXMLGregorianCalendarToDate() throws DatatypeConfigurationException {
      Calendar cal = GregorianCalendar.getInstance();
      EmployeeWithInnerClass source = new EmployeeWithInnerClass();
      source.setBirthDate(DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar) cal));
      TestObject result = mapper.map(source, TestObject.class);
      assertNotNull(result);
      assertEquals(cal.getTimeInMillis(), result.getDate().getTime());
  }
View Full Code Here


    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 }));

    SrcDeepObj src = newInstance(SrcDeepObj.class);
    src.setSomeList(Arrays.asList(new TestObject[] { testObject1, testObject2 }));
    src.setSrcNestedObj(srcNestedObj);
View Full Code Here

    src.setDest2(new Integer(857557));
    src.setDest5("789777");

    SrcDeepObj dest = mapper.map(src, SrcDeepObj.class);
    assertEquals("857557", dest.getSrcNestedObj().getSrcNestedObj2().getSimpleObjects()[0].getField1());
    TestObject destTestObj = (TestObject) dest.getSomeList().get(1);
    assertEquals("789777", ((AnotherTestObject) destTestObj.getEqualNamedList().get(0)).getField3());
  }
View Full Code Here

      mapper.map(new String(), null);
    } catch (Throwable t) {
    }

    TestDataFactory testDataFactory = new TestDataFactory(NoProxyDataObjectInstantiator.INSTANCE);
    TestObject to = testDataFactory.getInputGeneralMappingTestObject();
    TestObjectPrime prime = mapper.map(to, TestObjectPrime.class);
    TestObject source = mapper.map(prime, TestObject.class);
    mapper.map(source, TestObjectPrime.class);

    int numIters = 4000;
    for (int i = 0; i < numIters; i++) {
      SimpleObj src = testDataFactory.getSimpleObj();
View Full Code Here

*/
public class DestBeanCreatorTest extends AbstractDozerTest {

  @Test
  public void testCreatDestBeanNoFactory() throws Exception {
    TestObject bean = (TestObject) DestBeanCreator.create(new BeanCreationDirective(null, null, TestObject.class, null, null, null, null));

    assertNotNull(bean);
    assertNull(bean.getCreatedByFactoryName());
  }
View Full Code Here

  }

  @Test
  public void testCreatBeanFromFactory() throws Exception {
    String factoryName = "org.dozer.functional_tests.support.SampleCustomBeanFactory";
    TestObject bean = (TestObject) DestBeanCreator.create(
        new BeanCreationDirective(new TestObjectPrime(), TestObjectPrime.class, TestObject.class, null, factoryName, null, null));

    assertNotNull(bean);
    assertEquals(factoryName, bean.getCreatedByFactoryName());
  }
View Full Code Here

    for (int i = 0; i < THREAD_COUNT; i++) {
      new Thread(new Runnable() {
        public void run() {
          try {
            mapper.map(new TestObject(), TestObjectPrime.class);
          }
          finally {
            latch.countDown();
          }
        }
View Full Code Here

    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 }));

    SrcDeepObj src = newInstance(SrcDeepObj.class);
    src.setSomeList(Arrays.asList(new TestObject[] { testObject1, testObject2 }));
    src.setSrcNestedObj(srcNestedObj);
View Full Code Here

    src.setDest2(new Integer(857557));
    src.setDest5("789777");

    SrcDeepObj dest = mapper.map(src, SrcDeepObj.class);
    assertEquals("857557", dest.getSrcNestedObj().getSrcNestedObj2().getSimpleObjects()[0].getField1());
    TestObject destTestObj = (TestObject) dest.getSomeList().get(1);
    assertEquals("789777", ((AnotherTestObject) destTestObj.getEqualNamedList().get(0)).getField3());
  }
View Full Code Here

    assertNotNull(type);
  }

  @Test
  public void testSimple() {
    TestObject source = new TestObject();
    source.setOne("ABC");
    EmployeeWithInnerClass result = mapper.map(source, EmployeeWithInnerClass.class);
    assertNotNull(result);
    assertEquals("ABC", result.getFirstName());
  }
View Full Code Here

TOP

Related Classes of org.dozer.vo.TestObject

Copyright © 2018 www.massapicom. 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.