Package jodd.typeconverter.impl

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


  @Test
  public void testConversion() {
    DoubleConverter doubleConverter = new DoubleConverter();

    assertNull(doubleConverter.convert(null));

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
View Full Code Here


  public void testConversion() {
    DoubleConverter doubleConverter = new DoubleConverter();

    assertNull(doubleConverter.convert(null));

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
View Full Code Here

    DoubleConverter doubleConverter = new DoubleConverter();

    assertNull(doubleConverter.convert(null));

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));
View Full Code Here

    assertNull(doubleConverter.convert(null));

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));
View Full Code Here

    assertNull(doubleConverter.convert(null));

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));

    try {
View Full Code Here

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));

    try {
      doubleConverter.convert("aaaa");
View Full Code Here

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));

    try {
      doubleConverter.convert("aaaa");
      fail();
View Full Code Here

    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));

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

    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));

    try {
      doubleConverter.convert("aaaa");
      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.