Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteTest.java

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteTest.java
diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteTest.java
index 538432f7c1b1e833460d0ccbf9fe4f3f74071465..88c3e0b2a37c273425b60ab9582fdd9ea8eb9679 100644
--- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteTest.java
+++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteTest.java
@@ -35,6 +35,7 @@ import static java.util.Collections.singletonList;
import com.google.protobuf.UnittestImportLite.ImportEnumLite;
import com.google.protobuf.UnittestImportPublicLite.PublicImportMessageLite;
+import com.google.protobuf.UnittestLite;
import com.google.protobuf.UnittestLite.ForeignEnumLite;
import com.google.protobuf.UnittestLite.ForeignMessageLite;
import com.google.protobuf.UnittestLite.TestAllExtensionsLite;
@@ -45,15 +46,21 @@ import com.google.protobuf.UnittestLite.TestAllTypesLite.OneofFieldCase;
import com.google.protobuf.UnittestLite.TestAllTypesLite.OptionalGroup;
import com.google.protobuf.UnittestLite.TestAllTypesLite.RepeatedGroup;
import com.google.protobuf.UnittestLite.TestAllTypesLiteOrBuilder;
-import com.google.protobuf.UnittestLite.TestHugeFieldNumbersLite;
import com.google.protobuf.UnittestLite.TestNestedExtensionLite;
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;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
/**
* Test lite runtime.
*
@@ -132,6 +139,7 @@ public class LiteTest extends TestCase {
UnittestLite.optionalNestedMessageExtensionLite).getBb());
}
+
public void testClone() {
TestAllTypesLite.Builder expected = TestAllTypesLite.newBuilder()
.setOptionalInt32(123);
@@ -1425,12 +1433,6 @@ public class LiteTest extends TestCase {
assertToStringEquals("", TestAllTypesLite.getDefaultInstance());
}
- public void testToStringScalarFieldsSuffixedWithList() throws Exception {
- assertToStringEquals("deceptively_named_list: 7", TestAllTypesLite.newBuilder()
- .setDeceptivelyNamedList(7)
- .build());
- }
-
public void testToStringPrimitives() throws Exception {
TestAllTypesLite proto = TestAllTypesLite.newBuilder()
.setOptionalInt32(1)
@@ -1628,7 +1630,7 @@ public class LiteTest extends TestCase {
fail();
} catch (InvalidProtocolBufferException expected) {}
}
-
+
public void testMergeFrom_sanity() throws Exception {
TestAllTypesLite one = TestUtilLite.getAllLiteSetBuilder().build();
byte[] bytes = one.toByteArray();
@@ -1640,19 +1642,7 @@ public class LiteTest extends TestCase {
assertEquals(two, one);
assertEquals(one.hashCode(), two.hashCode());
}
-
- public void testMergeFromNoLazyFieldSharing() throws Exception {
- TestAllTypesLite.Builder sourceBuilder = TestAllTypesLite.newBuilder().setOptionalLazyMessage(
- TestAllTypesLite.NestedMessage.newBuilder().setBb(1));
- TestAllTypesLite.Builder targetBuilder =
- TestAllTypesLite.newBuilder().mergeFrom(sourceBuilder.build());
- assertEquals(1, sourceBuilder.getOptionalLazyMessage().getBb());
- // now change the sourceBuilder, and target value shouldn't be affected.
- sourceBuilder.setOptionalLazyMessage(
- TestAllTypesLite.NestedMessage.newBuilder().setBb(2));
- assertEquals(1, targetBuilder.getOptionalLazyMessage().getBb());
- }
-
+
public void testEquals_notEqual() throws Exception {
TestAllTypesLite one = TestUtilLite.getAllLiteSetBuilder().build();
byte[] bytes = one.toByteArray();
@@ -2212,21 +2202,6 @@ public class LiteTest extends TestCase {
assertEqualsAndHashCodeAreFalse(fooWithOnlyValue, fooWithValueAndUnknownFields);
assertEqualsAndHashCodeAreFalse(fooWithValueAndExtension, fooWithValueAndUnknownFields);
}
-
- public void testEqualsAndHashCodeWithExtensions() throws InvalidProtocolBufferException {
- Foo fooWithOnlyValue = Foo.newBuilder()
- .setValue(1)
- .build();
-
- Foo fooWithValueAndExtension = fooWithOnlyValue.toBuilder()
- .setValue(1)
- .setExtension(Bar.fooExt, Bar.newBuilder()
- .setName("name")
- .build())
- .build();
-
- assertEqualsAndHashCodeAreFalse(fooWithOnlyValue, fooWithValueAndExtension);
- }
// Test to ensure we avoid a class cast exception with oneofs.
public void testEquals_oneOfMessages() {
@@ -2242,25 +2217,6 @@ public class LiteTest extends TestCase {
assertFalse(other.equals(mine));
}
- public void testHugeFieldNumbers() throws InvalidProtocolBufferException {
- TestHugeFieldNumbersLite message =
- TestHugeFieldNumbersLite.newBuilder()
- .setOptionalInt32(1)
- .addRepeatedInt32(2)
- .setOptionalEnum(ForeignEnumLite.FOREIGN_LITE_FOO)
- .setOptionalString("xyz")
- .setOptionalMessage(ForeignMessageLite.newBuilder().setC(3).build())
- .build();
-
- TestHugeFieldNumbersLite parsedMessage =
- TestHugeFieldNumbersLite.parseFrom(message.toByteArray());
- assertEquals(1, parsedMessage.getOptionalInt32());
- assertEquals(2, parsedMessage.getRepeatedInt32(0));
- assertEquals(ForeignEnumLite.FOREIGN_LITE_FOO, parsedMessage.getOptionalEnum());
- assertEquals("xyz", parsedMessage.getOptionalString());
- assertEquals(3, parsedMessage.getOptionalMessage().getC());
- }
-
private void assertEqualsAndHashCodeAreFalse(Object o1, Object o2) {
assertFalse(o1.equals(o2));
assertFalse(o1.hashCode() == o2.hashCode());

Powered by Google App Engine
This is Rietveld 408576698