Package net.buffalo.protocal.converters.basic

Examples of net.buffalo.protocal.converters.basic.BooleanConverter.unmarshal()


public class PrimitiveDeserializerTest extends TestCase {
  public void testCanDeserializeBoolean() throws Exception {
    BooleanConverter bd = new BooleanConverter();

    Boolean b = (Boolean)bd.unmarshal(TestUtils.createStreamReader("<boolean>1</boolean>"), null);
    assertTrue(b.booleanValue());
    b = (Boolean)bd.unmarshal(TestUtils.createStreamReader("<boolean>0</boolean>"), null);
    assertFalse(b.booleanValue());
  }
 
View Full Code Here


  public void testCanDeserializeBoolean() throws Exception {
    BooleanConverter bd = new BooleanConverter();

    Boolean b = (Boolean)bd.unmarshal(TestUtils.createStreamReader("<boolean>1</boolean>"), null);
    assertTrue(b.booleanValue());
    b = (Boolean)bd.unmarshal(TestUtils.createStreamReader("<boolean>0</boolean>"), null);
    assertFalse(b.booleanValue());
  }
 
  public void testShouldThrowExceptionIfBooleanContainsInvalidString() throws Exception {
    BooleanConverter bd = new BooleanConverter();
View Full Code Here

  }
 
  public void testShouldThrowExceptionIfBooleanContainsInvalidString() throws Exception {
    BooleanConverter bd = new BooleanConverter();
    try {
      bd.unmarshal(TestUtils.createStreamReader("<boolean>false</boolean>"), null);
      fail();
    } catch (ProtocolException e) {
      assertNotNull(e);
      assertTrue(e.toString().indexOf("boolean") > -1);
    }
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.