Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.ShortConverter.convert()


  @Test
  public void testConversion() {
    ShortConverter shortConverter = new ShortConverter();

    assertNull(shortConverter.convert(null));

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(Short.valueOf((short) 1)));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert(Integer.valueOf(1)));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert(Double.valueOf(1.0D)));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert("1"));
View Full Code Here


  public void testConversion() {
    ShortConverter shortConverter = new ShortConverter();

    assertNull(shortConverter.convert(null));

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(Short.valueOf((short) 1)));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert(Integer.valueOf(1)));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert(Double.valueOf(1.0D)));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert("1"));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" 1 "));
View Full Code Here

    ShortConverter shortConverter = new ShortConverter();

    assertNull(shortConverter.convert(null));

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

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
View Full Code Here

    assertNull(shortConverter.convert(null));

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

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
    assertEquals(Short.valueOf((short) -1), shortConverter.convert(" -1 "));
View Full Code Here

    assertNull(shortConverter.convert(null));

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

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
    assertEquals(Short.valueOf((short) -1), shortConverter.convert(" -1 "));
    assertEquals(Short.valueOf((short) 32767), shortConverter.convert(" +32767 "));
View Full Code Here

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

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
    assertEquals(Short.valueOf((short) -1), shortConverter.convert(" -1 "));
    assertEquals(Short.valueOf((short) 32767), shortConverter.convert(" +32767 "));
    assertEquals(Short.valueOf((short) -32768), shortConverter.convert(" -32768 "));
View Full Code Here

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

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
    assertEquals(Short.valueOf((short) -1), shortConverter.convert(" -1 "));
    assertEquals(Short.valueOf((short) 32767), shortConverter.convert(" +32767 "));
    assertEquals(Short.valueOf((short) -32768), shortConverter.convert(" -32768 "));

    try {
View Full Code Here

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(Double.valueOf(1.0D)));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert("1"));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" 1 "));

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
    assertEquals(Short.valueOf((short) -1), shortConverter.convert(" -1 "));
    assertEquals(Short.valueOf((short) 32767), shortConverter.convert(" +32767 "));
    assertEquals(Short.valueOf((short) -32768), shortConverter.convert(" -32768 "));

    try {
      shortConverter.convert("a");
View Full Code Here

    assertEquals(Short.valueOf((short) 1), shortConverter.convert("1"));
    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" 1 "));

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
    assertEquals(Short.valueOf((short) -1), shortConverter.convert(" -1 "));
    assertEquals(Short.valueOf((short) 32767), shortConverter.convert(" +32767 "));
    assertEquals(Short.valueOf((short) -32768), shortConverter.convert(" -32768 "));

    try {
      shortConverter.convert("a");
      fail();
View Full Code Here

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" 1 "));

    assertEquals(Short.valueOf((short) 1), shortConverter.convert(" +1 "));
    assertEquals(Short.valueOf((short) -1), shortConverter.convert(" -1 "));
    assertEquals(Short.valueOf((short) 32767), shortConverter.convert(" +32767 "));
    assertEquals(Short.valueOf((short) -32768), shortConverter.convert(" -32768 "));

    try {
      shortConverter.convert("a");
      fail();
    } catch (TypeConversionException ignore) {
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.