| Index: third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
|
| diff --git a/third_party/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
|
| similarity index 86%
|
| rename from third_party/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
|
| rename to third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
|
| index 035917c83d62f656223f264f65a9c9f929e01c66..29e8d8759ff793835cdcf85070901ad58cdd1116 100644
|
| --- a/third_party/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
|
| +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
|
| @@ -33,6 +33,8 @@ package com.google.protobuf;
|
| import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar;
|
| import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.BarPrime;
|
| import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo;
|
| +import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestOneofEquals;
|
| +import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestRecursiveOneof;
|
|
|
| import junit.framework.TestCase;
|
|
|
| @@ -83,6 +85,16 @@ public class LiteEqualsAndHashTest extends TestCase {
|
| assertFalse(bar.equals(barPrime));
|
| }
|
|
|
| + public void testOneofEquals() throws Exception {
|
| + TestOneofEquals.Builder builder = TestOneofEquals.newBuilder();
|
| + TestOneofEquals message1 = builder.build();
|
| + // Set message2's name field to default value. The two messages should be different when we
|
| + // check with the oneof case.
|
| + builder.setName("");
|
| + TestOneofEquals message2 = builder.build();
|
| + assertFalse(message1.equals(message2));
|
| + }
|
| +
|
| public void testEqualsAndHashCodeWithUnknownFields() throws InvalidProtocolBufferException {
|
| Foo fooWithOnlyValue = Foo.newBuilder()
|
| .setValue(1)
|
| @@ -105,4 +117,9 @@ public class LiteEqualsAndHashTest extends TestCase {
|
| assertFalse(o1.equals(o2));
|
| assertFalse(o1.hashCode() == o2.hashCode());
|
| }
|
| +
|
| + public void testRecursiveHashcode() {
|
| + // This tests that we don't infinite loop.
|
| + TestRecursiveOneof.getDefaultInstance().hashCode();
|
| + }
|
| }
|
|
|