Examples of PrivatePrimitivePojo


Examples of com.bubble.serializer.objects.PrivatePrimitivePojo

    long longValue = generateLongTestValue();
    float floatValue = generateFloatTestValue();
    double doubleValue = generateDoubleTestValue();
    char charValue = generateCharTestValue();
   
    PrivatePrimitivePojo pojo = new PrivatePrimitivePojo(
        boolValue,
        byteValue,
        shortValue,
        intValue,
        longValue,
        floatValue,
        doubleValue,
        charValue
    );   
   
    SerializationContext ctx = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    ctx.serialize(pojo, buffer);
    buffer.flip();
    DeserializationContext dctx = new DeserializationContext();
    Object obj = dctx.deserialize(buffer);
    assertTrue("Object must be a PrimitivePojo", obj instanceof PrivatePrimitivePojo);
    PrivatePrimitivePojo response = (PrivatePrimitivePojo)obj;
    assertEquals(boolValue, response.isBooleanField());
    assertEquals(byteValue, response.getByteField());
    assertEquals(shortValue, response.getShortField());
    assertEquals(intValue, response.getIntField());
    assertEquals(longValue, response.getLongField());
    assertEquals(floatValue, response.getFloatField(), 0.0);
    assertEquals(doubleValue, response.getDoubleField(), 0.0);
    assertEquals(charValue, response.getCharField());
    System.out.println(pojo);
    System.out.println(response);
  }
View Full Code Here

Examples of com.bubble.serializer.objects.PrivatePrimitivePojo

    long longValue = generateLongTestValue();
    float floatValue = generateFloatTestValue();
    double doubleValue = generateDoubleTestValue();
    char charValue = generateCharTestValue();
   
    PrivatePrimitivePojo pojo = new PrivatePrimitivePojo(
        boolValue,
        byteValue,
        shortValue,
        intValue,
        longValue,
        floatValue,
        doubleValue,
        charValue
    );   
   
    SerializationContext ctx = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    ctx.serialize(pojo, buffer);
    buffer.flip();
    DeserializationContext dctx = new DeserializationContext();
    Object obj = dctx.deserialize(buffer);
    assertTrue("Object must be a PrimitivePojo", obj instanceof PrivatePrimitivePojo);
    PrivatePrimitivePojo response = (PrivatePrimitivePojo)obj;
    assertEquals(boolValue, response.isBooleanField());
    assertEquals(byteValue, response.getByteField());
    assertEquals(shortValue, response.getShortField());
    assertEquals(intValue, response.getIntField());
    assertEquals(longValue, response.getLongField());
    assertEquals(floatValue, response.getFloatField(), 0.0);
    assertEquals(doubleValue, response.getDoubleField(), 0.0);
    assertEquals(charValue, response.getCharField());
    System.out.println(pojo);
    System.out.println(response);
  }
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.