use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testMergeFromOtherMessage.
public void testMergeFromOtherMessage() throws Exception {
TypicalData data = TypicalData.newBuilder().setMyInt(123).build();
Message dataAsMsg = data;
TypicalData.Builder builder1 = TypicalData.newBuilder().mergeFrom(dataAsMsg);
TypicalData.Builder builder2 = TypicalData.newBuilder().mergeFrom(data);
assertEquals(123, builder1.getMyInt());
assertEquals(123, builder2.getMyInt());
}
use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testIsEqualAndHashCode.
public void testIsEqualAndHashCode() throws Exception {
TypicalDataMessage subMsg1 = TypicalDataMessage.newBuilder().setMyMessageInt(11).build();
TypicalData.Builder builder1 = TypicalData.newBuilder().setMyMessage(subMsg1).setMyInt(22);
TypicalData data1 = builder1.build();
TypicalDataMessage subMsg2 = TypicalDataMessage.newBuilder().setMyMessageInt(11).build();
TypicalData.Builder builder2 = TypicalData.newBuilder().setMyMessage(subMsg2).setMyInt(22);
TypicalData data2 = builder2.build();
TypicalDataMessage subMsg3 = TypicalDataMessage.newBuilder().setMyMessageInt(33).build();
TypicalData.Builder builder3 = TypicalData.newBuilder().setMyMessage(subMsg3).setMyInt(22);
TypicalData data3 = builder3.build();
// Builders are not equal.
assertFalse(builder1.equals(builder2));
assertFalse(builder2.equals(builder1));
assertTrue(data1.equals(data2));
assertTrue(data2.equals(data1));
assertEquals(data1.hashCode(), data2.hashCode());
assertFalse(data1.equals(data3));
assertFalse(data3.equals(data1));
}
use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testSetAndGetRepeatedTypicalData.
public void testSetAndGetRepeatedTypicalData() throws Exception {
TypicalData data = TypicalData.newBuilder().setMyInt(42).build();
TypicalDataSet dataset = TypicalDataSet.newBuilder().addRepeatedTypicalData(data).build();
assertEquals(1, dataset.getRepeatedTypicalDataCount());
assertEquals(42, dataset.getRepeatedTypicalData(0).getMyInt());
}
use of protos.TypicalData in project j2objc by google.
the class CompatibilityTest method testToBuilder.
public void testToBuilder() throws Exception {
TypicalData data = TypicalData.newBuilder().setMyInt(42).setMyMessage(TypicalDataMessage.newBuilder().setMyMessageInt(43)).build();
TypicalData.Builder builder = data.toBuilder();
TypicalDataMessage message = builder.getMyMessage();
assertNotNull(message);
assertEquals(43, message.getMyMessageInt());
}
Aggregations