use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testSetAndGetRepeatedbBool.
public void testSetAndGetRepeatedbBool() throws Exception {
TypicalData data = TypicalData.newBuilder().addRepeatedBool(true).build();
assertEquals(1, data.getRepeatedBoolCount());
assertTrue(data.getRepeatedBool(0));
}
use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testSetAndGetRepeatedUint32.
public void testSetAndGetRepeatedUint32() throws Exception {
TypicalData data = TypicalData.newBuilder().addRepeatedUint32(123).build();
assertEquals(1, data.getRepeatedUint32Count());
assertEquals(123, data.getRepeatedUint32(0));
}
use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testMessageLiteInterface.
public void testMessageLiteInterface() throws Exception {
ExtensionRegistryLite registry = ExtensionRegistryLite.newInstance();
TypicalData data = TypicalData.newBuilder().build();
MessageLite messageLite = data;
MessageLite.Builder builderLite = messageLite.newBuilderForType();
messageLite.writeTo(new ByteArrayOutputStream());
messageLite.writeDelimitedTo(new ByteArrayOutputStream());
builderLite.mergeFrom(new ByteArrayInputStream(new byte[0]));
builderLite.mergeFrom(new ByteArrayInputStream(new byte[0]), registry);
builderLite.mergeDelimitedFrom(new ByteArrayInputStream(new byte[0]));
builderLite.mergeDelimitedFrom(new ByteArrayInputStream(new byte[0]), registry);
assertEquals(0, messageLite.getSerializedSize());
}
use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testParseDelimitedFromInvalidProtocolBufferException.
public void testParseDelimitedFromInvalidProtocolBufferException() throws Exception {
try {
ByteArrayInputStream in = new ByteArrayInputStream(new byte[] { 0x03, 0x01, 0x02 });
@SuppressWarnings("unused") TypicalData output = TypicalData.parseDelimitedFrom(in);
fail("Expected InvalidProtocolBufferException to be thrown.");
} catch (InvalidProtocolBufferException e) {
// Expected
}
}
use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testMergeFromInvalidProtocolBufferException.
public void testMergeFromInvalidProtocolBufferException() throws Exception {
try {
ByteArrayInputStream in = new ByteArrayInputStream(new byte[] { 0x00 });
@SuppressWarnings("unused") TypicalData output = TypicalData.newBuilder().mergeFrom(in, ExtensionRegistry.getEmptyRegistry()).build();
fail("Expected InvalidProtocolBufferException to be thrown.");
} catch (InvalidProtocolBufferException e) {
// Expected
}
}
Aggregations