Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.MutableShortConverter


    register(MutableInteger.class, new MutableIntegerConverter(this));

    ShortConverter shortConverter = new ShortConverter();
    register(Short.class, shortConverter);
    register(short.class, shortConverter);
    register(MutableShort.class, new MutableShortConverter(this));

    LongConverter longConverter = new LongConverter();
    register(Long.class, longConverter);
    register(long.class, longConverter);
    register(MutableLong.class, new MutableLongConverter(this));
View Full Code Here


    register(MutableInteger.class, new MutableIntegerConverter(this));

    ShortConverter shortConverter = new ShortConverter();
    register(Short.class, shortConverter);
    register(short.class, shortConverter);
    register(MutableShort.class, new MutableShortConverter(this));

    LongConverter longConverter = new LongConverter();
    register(Long.class, longConverter);
    register(long.class, longConverter);
    register(MutableLong.class, new MutableLongConverter(this));
View Full Code Here

public class MutableShortConverterTest {

  @Test
  public void testConversion() {
    MutableShortConverter mutableShortConverter = (MutableShortConverter) TypeConverterManager.lookup(MutableShort.class);

    assertNull(mutableShortConverter.convert(null));

    assertEquals(new MutableShort((short) 1), mutableShortConverter.convert(new MutableShort(1)));
    assertEquals(new MutableShort((short) 1), mutableShortConverter.convert(Integer.valueOf(1)));
    assertEquals(new MutableShort((short) 1), mutableShortConverter.convert(Short.valueOf((short) 1)));
    assertEquals(new MutableShort((short) 1), mutableShortConverter.convert(Double.valueOf(1.0D)));
    assertEquals(new MutableShort((short) 1), mutableShortConverter.convert("1"));
    assertEquals(new MutableShort((short) 1), mutableShortConverter.convert(" 1 "));

    try {
      mutableShortConverter.convert("a");
      fail();
    } catch (TypeConversionException ignore) {
    }
  }
View Full Code Here

TOP

Related Classes of jodd.typeconverter.impl.MutableShortConverter

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.