Package org.dozer.vo

Examples of org.dozer.vo.ArrayDest


    ArraySource sourceBean = new ArraySource();
    String[] sourceArray = sourceBean.getPreInitializedArray();
    sourceArray[0] = "1";
    sourceArray[1] = "2";

    ArrayDest destinationBean = new ArrayDest();

    mapper.map(sourceBean, destinationBean, "array");

    String[] destinationArray = destinationBean.getPreInitializedArray();
    Assert.assertEquals(sourceArray.length + 2, destinationArray.length);

  }
View Full Code Here



  @Test
  public void testSetValueToNullArray() {
    ArraySource sourceBean = new ArraySource();
    ArrayDest arrayDest = mapper.map(sourceBean, ArrayDest.class, "single");
    Assert.assertEquals(1, arrayDest.getArray().length);
    Assert.assertNull("Element must contain null", arrayDest.getArray()[0]);
  }
View Full Code Here

    List<Integer> srcList = new ArrayList<Integer>();
    srcList.add(new Integer(2));
    srcList.add(new Integer(3));
    srcList.add(new Integer(8));
    sourceBean.setListOfIntegers(srcList);
    ArrayDest destBean = mapper.map(sourceBean, ArrayDest.class);

    int[]resultPrimitiveIntArray = destBean.getPrimitiveIntArray();
    for (int i = 0; i < srcList.size(); i++) {
      Integer srcValue = new Integer(srcList.get(i));
      int resultValue = resultPrimitiveIntArray[i];
      assertEquals( srcValue,new Integer(resultValue));
    }
View Full Code Here

   * Test primitive array to collection mapping and also test for bidirectionality
   * in the custom mappings XML file
   */
  @Test
  public void testPrimitiveArrayToCollection(){
     ArrayDest sourceBean = new ArrayDest();
     int[] primitiveIntArray = {2,3,8};
     sourceBean.setPrimitiveIntArray(primitiveIntArray);
     ArraySource destBean = mapper.map(sourceBean, ArraySource.class);
    
     List<Integer> resultList = destBean.getListOfIntegers();
     for (int i = 0; i < primitiveIntArray.length; i++) {
       int srcValue = primitiveIntArray[i];
View Full Code Here

    ArraySource sourceBean = new ArraySource();
    String[] sourceArray = sourceBean.getPreInitializedArray();
    sourceArray[0] = "1";
    sourceArray[1] = "2";

    ArrayDest destinationBean = new ArrayDest();

    mapper.map(sourceBean, destinationBean, "array");

    String[] destinationArray = destinationBean.getPreInitializedArray();
    Assert.assertEquals(sourceArray.length + 2, destinationArray.length);

  }
View Full Code Here


  @Test
  public void testSetValueToNullArray() {
    ArraySource sourceBean = new ArraySource();
    ArrayDest arrayDest = mapper.map(sourceBean, ArrayDest.class, "single");
    Assert.assertEquals(1, arrayDest.getArray().length);
    Assert.assertNull("Element must contain null", arrayDest.getArray()[0]);
  }
View Full Code Here

    List<Integer> srcList = new ArrayList<Integer>();
    srcList.add(new Integer(2));
    srcList.add(new Integer(3));
    srcList.add(new Integer(8));
    sourceBean.setListOfIntegers(srcList);
    ArrayDest destBean = mapper.map(sourceBean, ArrayDest.class);

    int[]resultPrimitiveIntArray = destBean.getPrimitiveIntArray();
    for (int i = 0; i < srcList.size(); i++) {
      Integer srcValue = new Integer(srcList.get(i));
      int resultValue = resultPrimitiveIntArray[i];
      assertEquals( srcValue,new Integer(resultValue));
    }
View Full Code Here

   * Test primitive array to collection mapping and also test for bidirectionality
   * in the custom mappings XML file
   */
  @Test
  public void testPrimitiveArrayToCollection(){
     ArrayDest sourceBean = new ArrayDest();
     int[] primitiveIntArray = {2,3,8};
     sourceBean.setPrimitiveIntArray(primitiveIntArray);
     ArraySource destBean = mapper.map(sourceBean, ArraySource.class);
    
     List<Integer> resultList = destBean.getListOfIntegers();
     for (int i = 0; i < primitiveIntArray.length; i++) {
       int srcValue = primitiveIntArray[i];
View Full Code Here

TOP

Related Classes of org.dozer.vo.ArrayDest

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.