Package ma.glasnost.orika

Examples of ma.glasnost.orika.MapperFacade.map()


            final A a = new A();
            final List<MyEnum> myEnumList = new ArrayList<MyEnum>();
            myEnumList.add(MyEnum.foo);
            a.setMyEnum(myEnumList);
            mapper.map(a, A2.class);

        }

        public static enum MyEnum {
            foo, bar
View Full Code Here


        Element name = new Element();
        name.setAttribute("first", "Chuck");
        name.setAttribute("last", "Testa");
        person.setAttribute("name", name);
       
        Person result = mapper.map(person, Person.class);
       
        Assert.assertEquals(((Element) person.getAttribute("name")).getAttribute("first"), result.firstName);
        Assert.assertEquals(((Element) person.getAttribute("name")).getAttribute("last"), result.lastName);
        Assert.assertEquals(((Element) person.getAttribute("employment")).getAttribute("salary") + "", result.salary);
        Assert.assertEquals(((Element) person.getAttribute("employment")).getAttribute("jobTitle"), result.jobTitle);
View Full Code Here

       
        B source = new B();
        source.setName("Israfil");
        source.setAge(1000);
       
        D target = mapperFacade.map(source, D.class);
       
        Assert.assertEquals(source.getName(), target.getNom());
        Assert.assertEquals(source.getAge(), target.getAges());
       
    }
View Full Code Here

        Assert.assertEquals(((Element) person.getAttribute("name")).getAttribute("first"), result.firstName);
        Assert.assertEquals(((Element) person.getAttribute("name")).getAttribute("last"), result.lastName);
        Assert.assertEquals(((Element) person.getAttribute("employment")).getAttribute("salary") + "", result.salary);
        Assert.assertEquals(((Element) person.getAttribute("employment")).getAttribute("jobTitle"), result.jobTitle);
       
        Element mapBack = mapper.map(result, Element.class);
       
        Assert.assertEquals(((Element) person.getAttribute("name")).getAttribute("first"),
                ((Element) mapBack.getAttribute("name")).getAttribute("first"));
        Assert.assertEquals(((Element) person.getAttribute("name")).getAttribute("last"),
                ((Element) mapBack.getAttribute("name")).getAttribute("last"));
View Full Code Here

       
        B source = new B();
        source.setName("Israfil");
        source.setAge(1000);
       
        F target = mapperFacade.map(source, F.class);
       
        Assert.assertEquals(source.getName(), target.getName());
        Assert.assertEquals(source.getAge(), target.getAge());
        Assert.assertEquals(1, target.getNameCalls());
    }
View Full Code Here

    B b = new B();
    b.i1 = null;
    b.i2 = null;
   
   
    A result = mapperFacade.map(b, A.class);
   
    Assert.assertNull(result.b);
   
    b.i1 = 2;
    b.i2 = null;
View Full Code Here

    B b = new B();
    b.i1 = 2;
    b.i2 = 3;
   
   
    A result = mapperFacade.map(b, A.class);
   
    Assert.assertNotNull(result.b);
    Assert.assertEquals(b.i1, result.b.i1);
    Assert.assertEquals(b.i2, result.b.i2);
   
View Full Code Here

       
        ChildEntity entity = new ChildEntity();
        entity.setId(1L);
        entity.setName("Khettabi");
       
        ChildDTO dto = mapper.map(entity, ChildDTO.class);
       
        Assert.assertEquals(entity.getId(), dto.getId());
        Assert.assertEquals(entity.getName(), dto.getName());
    }
   
View Full Code Here

       
        ChildEntity entity = new ChildEntity();
        entity.setId(1L);
        entity.setName("Khettabi");
       
        BaseDTO dto = mapper.map(entity, BaseDTO.class);
       
        Assert.assertTrue(dto instanceof ChildDTO);
        Assert.assertEquals(entity.getName(), ((ChildDTO) dto).getName());
    }
   
View Full Code Here

       
        ChildEntity entity = new ChildEntity();
        entity.setId(1L);
        entity.setName("Khettabi");
       
        Child2DTO dto = mapper.map(entity, Child2DTO.class);
       
        Assert.assertEquals(entity.getId(), dto.getId());
        Assert.assertEquals(entity.getName(), dto.getName());
        Assert.assertEquals("Hello Khettabi", dto.getMessage());
    }
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.