aboutsummaryrefslogtreecommitdiffhomepage
path: root/java/core/src/test/java/com/google/protobuf/TestUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/core/src/test/java/com/google/protobuf/TestUtil.java')
-rw-r--r--java/core/src/test/java/com/google/protobuf/TestUtil.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/java/core/src/test/java/com/google/protobuf/TestUtil.java b/java/core/src/test/java/com/google/protobuf/TestUtil.java
index d94f99e3..d4a18a22 100644
--- a/java/core/src/test/java/com/google/protobuf/TestUtil.java
+++ b/java/core/src/test/java/com/google/protobuf/TestUtil.java
@@ -232,12 +232,10 @@ import protobuf_unittest.UnittestProto.TestOneof2;
import protobuf_unittest.UnittestProto.TestPackedExtensions;
import protobuf_unittest.UnittestProto.TestPackedTypes;
import protobuf_unittest.UnittestProto.TestUnpackedTypes;
-
-import junit.framework.Assert;
-
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
+import junit.framework.Assert;
/**
* Contains methods for setting all fields of {@code TestAllTypes} to
@@ -260,6 +258,13 @@ public final class TestUtil {
}
/**
+ * Dirties the message by resetting the momoized serialized size.
+ */
+ public static void resetMemoizedSize(AbstractMessage message) {
+ message.memoizedSize = -1;
+ }
+
+ /**
* Get a {@code TestAllTypes} with all fields set as they would be by
* {@link #setAllFields(TestAllTypes.Builder)}.
*/