aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/test/java/com/google/protobuf/NanoTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/test/java/com/google/protobuf/NanoTest.java')
-rw-r--r--java/src/test/java/com/google/protobuf/NanoTest.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/java/src/test/java/com/google/protobuf/NanoTest.java b/java/src/test/java/com/google/protobuf/NanoTest.java
index 38fafb9..19f3957 100644
--- a/java/src/test/java/com/google/protobuf/NanoTest.java
+++ b/java/src/test/java/com/google/protobuf/NanoTest.java
@@ -2241,6 +2241,15 @@ public class NanoTest extends TestCase {
assertEquals(0, MessageNano.toByteArray(deserialized).length);
}
+ public void testMergeFrom() throws Exception {
+ SimpleMessageNano message = new SimpleMessageNano();
+ message.d = 123;
+ byte[] bytes = MessageNano.toByteArray(message);
+
+ SimpleMessageNano newMessage = MessageNano.mergeFrom(new SimpleMessageNano(), bytes);
+ assertEquals(message.d, newMessage.d);
+ }
+
private <T> List<T> list(T first, T... remaining) {
List<T> list = new ArrayList<T>();
list.add(first);