use of protos.MapMsg in project j2objc by google.
the class MapsTest method testEquals.
public void testEquals() throws Exception {
MapMsg msg1 = getFilledMessage();
MapMsg msg2 = getFilledMessage();
MapMsg msg3 = getFilledMessage().toBuilder().putIntString(7, "seven").build();
assertEquals(msg1, msg2);
assertFalse(msg1.equals(msg3));
assertFalse(msg3.equals(msg2));
assertEquals(msg1.hashCode(), msg2.hashCode());
}
use of protos.MapMsg in project j2objc by google.
the class MapsTest method testGetOrDefault.
public void testGetOrDefault() throws Exception {
MapMsg msg = getFilledMessage();
assertEquals("five", msg.getIntStringOrDefault(5, "default"));
assertEquals("six", msg.getIntStringOrDefault(6, "default"));
assertEquals("default", msg.getIntStringOrDefault(7, "default"));
}
use of protos.MapMsg in project j2objc by google.
the class MapsTest method testIsInitialized.
public void testIsInitialized() throws Exception {
MapMsg.Builder builder = MapMsg.newBuilder();
// Check no exception.
MapMsg unused = builder.build();
builder.putStringMessage("foo", MapValue.newBuilder().buildPartial());
try {
builder.build();
fail("Expected UninitializedMessageException");
} catch (RuntimeException e) {
// Expected.
}
}
use of protos.MapMsg in project j2objc by google.
the class MapsTest method testContains.
public void testContains() throws Exception {
MapMsg msg = getFilledMessage();
assertTrue(msg.containsStringMessage("abc"));
assertFalse(msg.containsStringMessage("ABC"));
assertTrue(msg.containsIntMessage(5280));
assertFalse(msg.containsIntMessage(5281));
}
Aggregations