Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.BooleanConverter


    DoubleConverter doubleConverter = new DoubleConverter();
    register(Double.class, doubleConverter);
    register(double.class, doubleConverter);
    register(MutableDouble.class, new MutableDoubleConverter(this));

    BooleanConverter booleanConverter = new BooleanConverter();
    register(Boolean.class, booleanConverter);
    register(boolean.class, booleanConverter);

    CharacterConverter characterConverter = new CharacterConverter();
    register(Character.class, characterConverter);
View Full Code Here


    DoubleConverter doubleConverter = new DoubleConverter();
    register(Double.class, doubleConverter);
    register(double.class, doubleConverter);
    register(MutableDouble.class, new MutableDoubleConverter(this));

    BooleanConverter booleanConverter = new BooleanConverter();
    register(Boolean.class, booleanConverter);
    register(boolean.class, booleanConverter);

    CharacterConverter characterConverter = new CharacterConverter();
    register(Character.class, characterConverter);
View Full Code Here

public class BooleanConverterTest {

  @Test
  public void testConversion() {
    BooleanConverter booleanConverter = new BooleanConverter();

    assertNull(booleanConverter.convert(null));

    assertEquals(Boolean.TRUE, booleanConverter.convert(Boolean.TRUE));

    assertEquals(Boolean.TRUE, booleanConverter.convert("yes"));
    assertEquals(Boolean.TRUE, booleanConverter.convert(" yes "));
    assertEquals(Boolean.TRUE, booleanConverter.convert("YES"));
    assertEquals(Boolean.TRUE, booleanConverter.convert("y"));
    assertEquals(Boolean.TRUE, booleanConverter.convert("Y"));
    assertEquals(Boolean.TRUE, booleanConverter.convert("on"));
    assertEquals(Boolean.TRUE, booleanConverter.convert("ON"));
    assertEquals(Boolean.TRUE, booleanConverter.convert("1"));

    assertEquals(Boolean.FALSE, booleanConverter.convert("no"));
    assertEquals(Boolean.FALSE, booleanConverter.convert(" no "));
    assertEquals(Boolean.FALSE, booleanConverter.convert("NO"));
    assertEquals(Boolean.FALSE, booleanConverter.convert("n"));
    assertEquals(Boolean.FALSE, booleanConverter.convert("N"));
    assertEquals(Boolean.FALSE, booleanConverter.convert("off"));
    assertEquals(Boolean.FALSE, booleanConverter.convert("OFF"));
    assertEquals(Boolean.FALSE, booleanConverter.convert("0"));
  }
View Full Code Here

TOP

Related Classes of jodd.typeconverter.impl.BooleanConverter

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.