Package org.dozer.vo

Examples of org.dozer.vo.ArraySource


  /**
   * Test shows how simple array grows, when dest array is not null
   */
  @Test
  public void testArrayGrowConversion() {
    ArraySource sourceBean = new ArraySource();
    String[] sourceArray = sourceBean.getPreInitializedArray();
    sourceArray[0] = "1";
    sourceArray[1] = "2";

    ArrayDest destinationBean = new ArrayDest();

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

  /**
   * Test collection to primitive array mapping
   */
  @Test
  public void testCollectionToPrimitiveArray(){
    ArraySource sourceBean = new ArraySource();
    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));
View Full Code Here

  @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];
       int resultValue = resultList.get(i);
       assertEquals( srcValue,resultValue);
     }
View Full Code Here

  /**
   * Test shows how simple array grows, when dest array is not null
   */
  @Test
  public void testArrayGrowConversion() {
    ArraySource sourceBean = new ArraySource();
    String[] sourceArray = sourceBean.getPreInitializedArray();
    sourceArray[0] = "1";
    sourceArray[1] = "2";

    ArrayDest destinationBean = new ArrayDest();

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

  /**
   * Test collection to primitive array mapping
   */
  @Test
  public void testCollectionToPrimitiveArray(){
    ArraySource sourceBean = new ArraySource();
    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));
View Full Code Here

  @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];
       int resultValue = resultList.get(i);
       assertEquals( srcValue,resultValue);
     }
View Full Code Here

TOP

Related Classes of org.dozer.vo.ArraySource

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.