Package org.dozer.vo

Examples of org.dozer.vo.Car


  @Test
  public void testSimpleCustomConverter_ImplicitMappingWithInheritance() throws Exception {
    mapper = getMapper("simpleCustomConverter.xml");

    Car car = newInstance(Car.class);
    Van van = mapper.map(car, Van.class);
    assertEquals("defaultValueSetByCustomConverter", van.getName());
    // map back
    Car carDest = mapper.map(van, Car.class);
    assertEquals("defaultValueSetByCustomConverter", carDest.getName());

    // test that we get customconverter even though it wasn't defined in the mapping file
    Moped moped = newInstance(Moped.class);
    Bus bus = mapper.map(moped, Bus.class);
    assertEquals("defaultValueSetByCustomConverter", bus.getName());
View Full Code Here


    // Do some mapping so that the mapping files are actually loaded
    assertCommon(mapper);

    // make sure that the customconverter was injected
    Car car = new Car();
    Van van = cleanMapper.map(car, Van.class);
    assertEquals("injectedName", van.getName());
    // map back
    Car carDest = cleanMapper.map(van, Car.class);
    assertEquals("injectedName", carDest.getName());

    // test that we get customconverter even though it wasn't defined in the mapping file
    Moped moped = new Moped();
    Bus bus = cleanMapper.map(moped, Bus.class);
    assertEquals("injectedName", bus.getName());
View Full Code Here

    Set<TestReferenceFoo> set = newInstance(HashSet.class);
    TestReferenceFoo foo4 = newInstance(TestReferenceFoo.class);
    foo4.setA("a");
    set.add(foo4);
    tro.setSetToSet(set);
    Car car = new Car();
    car.setName("myName");
    tro.setCars(new Car[] { car });
    Car car2 = new Car();
    car2.setName("myName");
    List<Car> vehicles = newInstance(ArrayList.class);
    vehicles.add(car2);
    tro.setVehicles(vehicles);
    TestReferenceObject toClone = (TestReferenceObject) SerializationUtils.clone(tro);
    TestReferencePrimeObject trop = mapper.map(tro, TestReferencePrimeObject.class);
View Full Code Here

    return house;
  }

  public HydrateTestObject getExpectedTestNoSourceValueIterateFieldMapHydrateTestObject() {
    Car car = newInstance(Car.class);
    car.setName("Build by buildCar");
    HydrateTestObject hto = newInstance(HydrateTestObject.class);
    // Problem - Destination Field is array of 'cars' - but getMethod() is buildCar() which returns a Car. MapCollection
    // method can not handle this...
    // DestinationType is a Car and it should be an array.
    // hto.addCar(car);
View Full Code Here

    return custom;
  }

  public DehydrateTestObject getInputTestHydrateAndMoreDehydrateTestObject() {
    DehydrateTestObject custom = newInstance(DehydrateTestObject.class);
    Car car = newInstance(Car.class);
    car.setName("name");
    List<Car> carList = newInstance(ArrayList.class);
    carList.add(car);
    custom.setCars(carList);

    Apple apple = newInstance(Apple.class);
    apple.setName("name");
    Orange orange = newInstance(Orange.class);
    orange.setName("name");
    List<Fruit> fruitList = newInstance(ArrayList.class);
    fruitList.add(apple);
    fruitList.add(orange);
    custom.setFruit(fruitList);

    Van van = newInstance(Van.class);
    van.setName("name");
    List<Van> vanList = newInstance(ArrayList.class);
    vanList.add(van);
    custom.setVans(vanList);

    AppleComputer apple1 = newInstance(AppleComputer.class);
    apple1.setName("name");
    AppleComputer apple2 = newInstance(AppleComputer.class);
    apple2.setName("name");
    List<AppleComputer> compList = newInstance(ArrayList.class);
    compList.add(apple1);
    compList.add(apple2);
    custom.setAppleComputers(compList);

    Car iterateCar = newInstance(Car.class);
    iterateCar.setName("name");
    List<Car> iterateCarList = newInstance(ArrayList.class);
    iterateCarList.add(car);
    custom.setIterateCars(iterateCarList);

    iterateCar.setName("name");
    List<Car> iterateMoreCarList = newInstance(ArrayList.class);
    iterateMoreCarList.add(car);
    custom.setIterateMoreCars(iterateMoreCarList);

    return custom;
View Full Code Here

    return custom;
  }

  public HydrateTestObject getExpectedTestHydrateAndMoreHydrateTestObject() {
    HydrateTestObject hto = newInstance(HydrateTestObject.class);
    Car car = newInstance(Car.class);
    car.setName("name");
    Car buildByCar = newInstance(Car.class);
    buildByCar.setName("Build by buildCar");
    Van van = newInstance(Van.class);
    van.setName("name");

    AppleComputer apple1 = newInstance(AppleComputer.class);
    apple1.setName("name");
View Full Code Here

    return hto;
  }

  public HydrateTestObject getInputTestHydrateAndMoreHydrateTestObject() {
    HydrateTestObject hto = newInstance(HydrateTestObject.class);
    Car car = newInstance(Car.class);
    car.setName("name");
    Van van = newInstance(Van.class);
    van.setName("name");
    List<Vehicle> vehicles = newInstance(ArrayList.class);
    vehicles.add(car);
    vehicles.add(van);
View Full Code Here

  }

  public DehydrateTestObject getExpectedTestHydrateAndMoreDehydrateTestObject() {
    DehydrateTestObject custom = newInstance(DehydrateTestObject.class);
    Car car = newInstance(Car.class);
    car.setName("name");

    AppleComputer apple1 = newInstance(AppleComputer.class);
    apple1.setName("name");
    AppleComputer apple2 = newInstance(AppleComputer.class);
    apple2.setName("name");
View Full Code Here

    return house;
  }

  public HydrateTestObject getExpectedTestNoSourceValueIterateFieldMapHydrateTestObject() {
    Car car = newInstance(Car.class);
    car.setName("Build by buildCar");
    HydrateTestObject hto = newInstance(HydrateTestObject.class);
    // Problem - Destination Field is array of 'cars' - but getMethod() is buildCar() which returns a Car. MapCollection
    // method can not handle this...
    // DestinationType is a Car and it should be an array.
    // hto.addCar(car);
View Full Code Here

    return custom;
  }

  public DehydrateTestObject getInputTestHydrateAndMoreDehydrateTestObject() {
    DehydrateTestObject custom = newInstance(DehydrateTestObject.class);
    Car car = newInstance(Car.class);
    car.setName("name");
    List<Car> carList = newInstance(ArrayList.class);
    carList.add(car);
    custom.setCars(carList);

    Apple apple = newInstance(Apple.class);
    apple.setName("name");
    Orange orange = newInstance(Orange.class);
    orange.setName("name");
    List<Fruit> fruitList = newInstance(ArrayList.class);
    fruitList.add(apple);
    fruitList.add(orange);
    custom.setFruit(fruitList);

    Van van = newInstance(Van.class);
    van.setName("name");
    List<Van> vanList = newInstance(ArrayList.class);
    vanList.add(van);
    custom.setVans(vanList);

    AppleComputer apple1 = newInstance(AppleComputer.class);
    apple1.setName("name");
    AppleComputer apple2 = newInstance(AppleComputer.class);
    apple2.setName("name");
    List<AppleComputer> compList = newInstance(ArrayList.class);
    compList.add(apple1);
    compList.add(apple2);
    custom.setAppleComputers(compList);

    Car iterateCar = newInstance(Car.class);
    iterateCar.setName("name");
    List<Car> iterateCarList = newInstance(ArrayList.class);
    iterateCarList.add(car);
    custom.setIterateCars(iterateCarList);

    iterateCar.setName("name");
    List<Car> iterateMoreCarList = newInstance(ArrayList.class);
    iterateMoreCarList.add(car);
    custom.setIterateMoreCars(iterateMoreCarList);

    return custom;
View Full Code Here

TOP

Related Classes of org.dozer.vo.Car

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.