Package org.dozer.vo.enumtest

Examples of org.dozer.vo.enumtest.MyBean


   * Test on a mapping from enum types to integer.
   */
  @Test
  public void testEnumMapsToInteger() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBean src = new MyBean();
    src.setSrcType(SrcType.FOO);
    src.setSrcTypeWithOverride(SrcTypeWithOverride.BAR);
    MyBeanPrimeInteger dest = mapper.map(src, MyBeanPrimeInteger.class);
    assertEquals(0, dest.getFirst());
    assertEquals(Integer.valueOf(1), dest.getSecond());
  }
View Full Code Here


   * Test on a mapping from enum types to long.
   */
  @Test
  public void testEnumMapsToLong() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBean src = new MyBean();
    src.setSrcType(SrcType.FOO);
    src.setSrcTypeWithOverride(SrcTypeWithOverride.BAR);
    MyBeanPrimeLong dest = mapper.map(src, MyBeanPrimeLong.class);
    assertEquals(0, dest.getFirst());
    assertEquals(Long.valueOf(1L), dest.getSecond());
  }
View Full Code Here

  public void testByteMapsToEnumOutOfOrdinalRange() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeByte src = new MyBeanPrimeByte();
    src.setFirst((byte) 0);
    src.setSecond((byte) 3);
    MyBean dest = mapper.map(src, MyBean.class);
  }
View Full Code Here

  public void testShortMapsToEnumOutOfOrdinalRange() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeShort src = new MyBeanPrimeShort();
    src.setFirst((short) 0);
    src.setSecond((short) 3);
    MyBean dest = mapper.map(src, MyBean.class);
  }
View Full Code Here

  public void testIntegerMapsToEnumOutOfOrdinalRange() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeInteger src = new MyBeanPrimeInteger();
    src.setFirst(0);
    src.setSecond(3);
    MyBean dest = mapper.map(src, MyBean.class);
  }
View Full Code Here

  public void testLongMapsToEnumOutOfOrdinalRange() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeLong src = new MyBeanPrimeLong();
    src.setFirst(0L);
    src.setSecond(3L);
    MyBean dest = mapper.map(src, MyBean.class);
  }
View Full Code Here

  @Test(expected = MappingException.class)
  public void testStringMapsToEnumNonexistEnumValue() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeString src = new MyBeanPrimeString();
    src.setDestType("BAZ");
    MyBean dest = mapper.map(src, MyBean.class);
  }
View Full Code Here

TOP

Related Classes of org.dozer.vo.enumtest.MyBean

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.