Examples of MyBean


Examples of org.dozer.vo.enumtest.MyBean

   * Test on a mapping from Overrided Enum to Overrided Enum.
   */
  @Test
  public void testOverridedEnumMapsToOverridedEnum() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBean src = newInstance(MyBean.class);
    src.setSrcTypeWithOverride(SrcTypeWithOverride.FOO);
    MyBeanPrime dest = mapper.map(src, MyBeanPrime.class);
    assertEquals(src.getSrcTypeWithOverride().toString(), dest.getDestTypeWithOverride().toString());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

  /**
   * Test on a mapping from Enum to itself. This test is used to reproduce bug#1806780.
   */
  @Test
  public void testEnumMapsToItself() {
    MyBean src = newInstance(MyBean.class);
    src.setSrcType(SrcType.FOO);
    MyBean dest = mapper.map(src, MyBean.class);
    assertEquals(src.getSrcType(), dest.getSrcType());
    assertEquals(src.getSrcTypeWithOverride(), dest.getSrcTypeWithOverride());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

   * Test on if mapping to nonexist enum value would throw exception.
   */
  @Test(expected = IllegalArgumentException.class)
  public void testEnumMapsToNonexistEnumValue() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBean src = newInstance(MyBean.class);
    src.setSrcType(SrcType.BAR);
    mapper.map(src, MyBeanPrime.class);
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

   * Test on a mapping from enum to {@link String}.
   */
  @Test
  public void testEnumMapsToString() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBean src = new MyBean();
    src.setSrcType(SrcType.FOO);
    MyBeanPrimeString dest = mapper.map(src, MyBeanPrimeString.class);
    assertEquals("FOO", dest.getDestType());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

  public void testStringMapsToEnum() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeString src = new MyBeanPrimeString();
    src.setDestType("FOO");
    src.setDestTypeWithOverride("BAR");
    MyBean dest = mapper.map(src, MyBean.class);
    assertEquals(SrcType.FOO, dest.getSrcType());
    assertEquals(SrcTypeWithOverride.BAR, dest.getSrcTypeWithOverride());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

  public void testByteMapsToEnum() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeByte src = new MyBeanPrimeByte();
    src.setFirst((byte) 0);
    src.setSecond((byte) 1);
    MyBean dest = mapper.map(src, MyBean.class);
    assertEquals(SrcType.FOO, dest.getSrcType());
    assertEquals(SrcTypeWithOverride.BAR, dest.getSrcTypeWithOverride());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

  public void testShortMapsToEnum() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeShort src = new MyBeanPrimeShort();
    src.setFirst((short) 0);
    src.setSecond((short) 1);
    MyBean dest = mapper.map(src, MyBean.class);
    assertEquals(SrcType.FOO, dest.getSrcType());
    assertEquals(SrcTypeWithOverride.BAR, dest.getSrcTypeWithOverride());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

  public void testIntegerMapsToEnum() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeInteger src = new MyBeanPrimeInteger();
    src.setFirst(0);
    src.setSecond(1);
    MyBean dest = mapper.map(src, MyBean.class);
    assertEquals(SrcType.FOO, dest.getSrcType());
    assertEquals(SrcTypeWithOverride.BAR, dest.getSrcTypeWithOverride());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

  public void testLongMapsToEnum() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBeanPrimeLong src = new MyBeanPrimeLong();
    src.setFirst(0L);
    src.setSecond(1L);
    MyBean dest = mapper.map(src, MyBean.class);
    assertEquals(SrcType.FOO, dest.getSrcType());
    assertEquals(SrcTypeWithOverride.BAR, dest.getSrcTypeWithOverride());
  }
View Full Code Here

Examples of org.dozer.vo.enumtest.MyBean

   * Test on a mapping from enum types to byte.
   */
  @Test
  public void testEnumMapsToByte() {
    mapper = getMapper(new String[] { "enumMapping.xml" });
    MyBean src = new MyBean();
    src.setSrcType(SrcType.FOO);
    src.setSrcTypeWithOverride(SrcTypeWithOverride.BAR);
    MyBeanPrimeByte dest = mapper.map(src, MyBeanPrimeByte.class);
    assertEquals(0, dest.getFirst());
    assertEquals(Byte.valueOf((byte) 1), dest.getSecond());
  }
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.