31 package com.google.protobuf;
33 import static org.junit.Assert.assertEquals;
36 import proto3_unittest.UnittestProto3;
37 import org.junit.Test;
38 import org.junit.runner.RunWith;
39 import org.junit.runners.JUnit4;
42 @RunWith(JUnit4.class)
46 testProto2Message(UnittestProto.TestEmptyMessage.getDefaultInstance());
47 testProto2Message(UnittestProto.TestEmptyMessageWithExtensions.getDefaultInstance());
52 UnittestProto.TestEmptyMessageWithExtensions.getDescriptor()));
57 testProto3Message(UnittestProto3.TestEmptyMessage.getDefaultInstance());
63 assertUnknownFieldsPreserved(
message);
64 assertUnknownFieldsExplicitlyDiscarded(
message);
65 assertReuseCodedInputStreamPreserve(
message);
66 assertUnknownFieldsInUnknownFieldSetArePreserve(
message);
70 assertUnknownFieldsPreserved(
message);
71 assertUnknownFieldsExplicitlyDiscarded(
message);
72 assertReuseCodedInputStreamPreserve(
message);
73 assertUnknownFieldsInUnknownFieldSetArePreserve(
message);
77 final int messageSize = payload.size();
78 byte[] copied =
new byte[messageSize * 2];
79 payload.copyTo(copied, 0);
80 payload.copyTo(copied, messageSize);
84 int oldLimit =
input.pushLimit(messageSize);
87 input.popLimit(oldLimit);