|
13 | 13 | import com.google.protobuf.CodedOutputStream.OutOfSpaceException;
|
14 | 14 | import protobuf_unittest.UnittestProto.SparseEnumMessage;
|
15 | 15 | import protobuf_unittest.UnittestProto.TestAllTypes;
|
16 |
| -import protobuf_unittest.UnittestProto.TestPackedTypes; |
17 | 16 | import protobuf_unittest.UnittestProto.TestSparseEnum;
|
18 | 17 | import java.io.ByteArrayInputStream;
|
19 | 18 | import java.io.ByteArrayOutputStream;
|
@@ -327,47 +326,6 @@ public void testEncodeZigZag() throws Exception {
|
327 | 326 | .isEqualTo(-75123905439571256L);
|
328 | 327 | }
|
329 | 328 |
|
330 |
| - /** Tests writing a whole message with every field type. */ |
331 |
| - @Test |
332 |
| - public void testWriteWholeMessage() throws Exception { |
333 |
| - final byte[] expectedBytes = TestUtil.getGoldenMessage().toByteArray(); |
334 |
| - TestAllTypes message = TestUtil.getAllSet(); |
335 |
| - |
336 |
| - for (OutputType outputType : OutputType.values()) { |
337 |
| - Coder coder = outputType.newCoder(message.getSerializedSize()); |
338 |
| - message.writeTo(coder.stream()); |
339 |
| - coder.stream().flush(); |
340 |
| - byte[] rawBytes = coder.toByteArray(); |
341 |
| - assertEqualBytes(outputType, expectedBytes, rawBytes); |
342 |
| - } |
343 |
| - |
344 |
| - // Try different block sizes. |
345 |
| - for (int blockSize = 1; blockSize < 256; blockSize *= 2) { |
346 |
| - Coder coder = OutputType.STREAM.newCoder(blockSize); |
347 |
| - message.writeTo(coder.stream()); |
348 |
| - coder.stream().flush(); |
349 |
| - assertEqualBytes(OutputType.STREAM, expectedBytes, coder.toByteArray()); |
350 |
| - } |
351 |
| - } |
352 |
| - |
353 |
| - /** |
354 |
| - * Tests writing a whole message with every packed field type. Ensures the wire format of packed |
355 |
| - * fields is compatible with C++. |
356 |
| - */ |
357 |
| - @Test |
358 |
| - public void testWriteWholePackedFieldsMessage() throws Exception { |
359 |
| - byte[] expectedBytes = TestUtil.getGoldenPackedFieldsMessage().toByteArray(); |
360 |
| - TestPackedTypes message = TestUtil.getPackedSet(); |
361 |
| - |
362 |
| - for (OutputType outputType : OutputType.values()) { |
363 |
| - Coder coder = outputType.newCoder(message.getSerializedSize()); |
364 |
| - message.writeTo(coder.stream()); |
365 |
| - coder.stream().flush(); |
366 |
| - byte[] rawBytes = coder.toByteArray(); |
367 |
| - assertEqualBytes(outputType, expectedBytes, rawBytes); |
368 |
| - } |
369 |
| - } |
370 |
| - |
371 | 329 | /**
|
372 | 330 | * Test writing a message containing a negative enum value. This used to fail because the size was
|
373 | 331 | * not properly computed as a sign-extended varint.
|
|
0 commit comments