Package jodd.typeconverter.impl

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


  @Test
  public void testConversion() {
    IntegerConverter integerConverter = new IntegerConverter();

    assertNull(integerConverter.convert(null));

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


  public void testConversion() {
    IntegerConverter integerConverter = new IntegerConverter();

    assertNull(integerConverter.convert(null));

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

    IntegerConverter integerConverter = new IntegerConverter();

    assertNull(integerConverter.convert(null));

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

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
View Full Code Here

    assertNull(integerConverter.convert(null));

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

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
    assertEquals(Integer.valueOf(-1), integerConverter.convert(" -1 "));
View Full Code Here

    assertNull(integerConverter.convert(null));

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

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
    assertEquals(Integer.valueOf(-1), integerConverter.convert(" -1 "));
    assertEquals(Integer.valueOf(2147483647), integerConverter.convert(" +2147483647 "));
View Full Code Here

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

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
    assertEquals(Integer.valueOf(-1), integerConverter.convert(" -1 "));
    assertEquals(Integer.valueOf(2147483647), integerConverter.convert(" +2147483647 "));
    assertEquals(Integer.valueOf(-2147483648), integerConverter.convert(" -2147483648 "));
View Full Code Here

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

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
    assertEquals(Integer.valueOf(-1), integerConverter.convert(" -1 "));
    assertEquals(Integer.valueOf(2147483647), integerConverter.convert(" +2147483647 "));
    assertEquals(Integer.valueOf(-2147483648), integerConverter.convert(" -2147483648 "));

    try {
View Full Code Here

    assertEquals(Integer.valueOf(1), integerConverter.convert(Double.valueOf(1.0D)));
    assertEquals(Integer.valueOf(1), integerConverter.convert("1"));
    assertEquals(Integer.valueOf(1), integerConverter.convert(" 1 "));

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
    assertEquals(Integer.valueOf(-1), integerConverter.convert(" -1 "));
    assertEquals(Integer.valueOf(2147483647), integerConverter.convert(" +2147483647 "));
    assertEquals(Integer.valueOf(-2147483648), integerConverter.convert(" -2147483648 "));

    try {
      assertEquals(Integer.valueOf(1), integerConverter.convert(" 2147483648 "));
View Full Code Here

    assertEquals(Integer.valueOf(1), integerConverter.convert("1"));
    assertEquals(Integer.valueOf(1), integerConverter.convert(" 1 "));

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
    assertEquals(Integer.valueOf(-1), integerConverter.convert(" -1 "));
    assertEquals(Integer.valueOf(2147483647), integerConverter.convert(" +2147483647 "));
    assertEquals(Integer.valueOf(-2147483648), integerConverter.convert(" -2147483648 "));

    try {
      assertEquals(Integer.valueOf(1), integerConverter.convert(" 2147483648 "));
      fail();
View Full Code Here

    assertEquals(Integer.valueOf(1), integerConverter.convert(" 1 "));

    assertEquals(Integer.valueOf(1), integerConverter.convert(" +1 "));
    assertEquals(Integer.valueOf(-1), integerConverter.convert(" -1 "));
    assertEquals(Integer.valueOf(2147483647), integerConverter.convert(" +2147483647 "));
    assertEquals(Integer.valueOf(-2147483648), integerConverter.convert(" -2147483648 "));

    try {
      assertEquals(Integer.valueOf(1), integerConverter.convert(" 2147483648 "));
      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.