Package protobuf_unittest.LazyFieldsLite

Examples of protobuf_unittest.LazyFieldsLite.LazyMessageLite.toByteString()


        .setNum(1)
        .setInner(inner)
        .setOneofInner(inner)
        .build();

    ByteString bytes = outer.toByteString();
    assertEquals(bytes.size(), outer.getSerializedSize());

    LazyMessageLite deserialized = LazyMessageLite.parseFrom(bytes);

    assertEquals(1, deserialized.getNum());
View Full Code Here


    assertEquals(2,  deserialized.getOneofInner().getNum());
    assertEquals(42,  deserialized.getOneofInner().getNumWithDefault());
    assertEquals(3,  deserialized.getOneofInner().getNested().getNum());
    assertEquals(4,  deserialized.getOneofInner().getNested().getNumWithDefault());

    assertEquals(bytes, deserialized.toByteString());
  }

  public void testLaziness() throws InvalidProtocolBufferException {
    LazyInnerMessageLite inner = LazyInnerMessageLite.newBuilder()
        .setNum(2)
View Full Code Here

    LazyMessageLite outer = LazyMessageLite.newBuilder()
        .setNum(1)
        .setInner(inner)
        .setOneofInner(inner)
        .build();
    ByteString bytes = outer.toByteString();


    // The parser for inner / oneofInner message shouldn't be used if
    // getInner / getOneofInner is not called.
    LazyInnerMessageLite.PARSER = EasyMock.createStrictMock(Parser.class);
View Full Code Here

        .setNum(1)
        .setInner(inner)
        .setOneofInner(inner)
        .build();

    ByteString bytes = outer.toByteString();
    assertEquals(bytes.size(), outer.getSerializedSize());

    LazyMessageLite deserialized = LazyMessageLite.parseFrom(bytes);

    assertEquals(1, deserialized.getNum());
View Full Code Here

    assertEquals(2,  deserialized.getOneofInner().getNum());
    assertEquals(42,  deserialized.getOneofInner().getNumWithDefault());
    assertEquals(3,  deserialized.getOneofInner().getNested().getNum());
    assertEquals(4,  deserialized.getOneofInner().getNested().getNumWithDefault());

    assertEquals(bytes, deserialized.toByteString());
  }

  public void testLaziness() throws InvalidProtocolBufferException {
    LazyInnerMessageLite inner = LazyInnerMessageLite.newBuilder()
        .setNum(2)
View Full Code Here

    LazyMessageLite outer = LazyMessageLite.newBuilder()
        .setNum(1)
        .setInner(inner)
        .setOneofInner(inner)
        .build();
    ByteString bytes = outer.toByteString();


    // The parser for inner / oneofInner message shouldn't be used if
    // getInner / getOneofInner is not called.
    LazyInnerMessageLite.PARSER = EasyMock.createStrictMock(Parser.class);
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.