OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 14 matching lines...) Expand all Loading... |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 package com.google.protobuf; | 31 package com.google.protobuf; |
32 | 32 |
33 | 33 |
34 import protobuf_unittest.UnittestProto; | 34 import protobuf_unittest.UnittestProto; |
35 | 35 import java.io.IOException; |
36 import junit.framework.TestCase; | 36 import junit.framework.TestCase; |
37 | 37 |
38 import java.io.IOException; | |
39 | |
40 /** | 38 /** |
41 * Tests to make sure the lazy conversion of UTF8-encoded byte arrays to | 39 * Tests to make sure the lazy conversion of UTF8-encoded byte arrays to |
42 * strings works correctly. | 40 * strings works correctly. |
43 * | 41 * |
44 * @author jonp@google.com (Jon Perlow) | 42 * @author jonp@google.com (Jon Perlow) |
45 */ | 43 */ |
46 public class LazyStringEndToEndTest extends TestCase { | 44 public class LazyStringEndToEndTest extends TestCase { |
47 | 45 |
48 private static ByteString TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8 = | 46 private static ByteString TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8 = |
49 ByteString.copyFrom(new byte[] { | 47 ByteString.copyFrom(new byte[] { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 assertSame(optional, proto.toBuilder().getOptionalStringBytes()); | 121 assertSame(optional, proto.toBuilder().getOptionalStringBytes()); |
124 | 122 |
125 ByteString repeated0 = proto.getRepeatedStringBytes(0); | 123 ByteString repeated0 = proto.getRepeatedStringBytes(0); |
126 ByteString repeated1 = proto.getRepeatedStringBytes(1); | 124 ByteString repeated1 = proto.getRepeatedStringBytes(1); |
127 assertSame(repeated0, proto.getRepeatedStringBytes(0)); | 125 assertSame(repeated0, proto.getRepeatedStringBytes(0)); |
128 assertSame(repeated1, proto.getRepeatedStringBytes(1)); | 126 assertSame(repeated1, proto.getRepeatedStringBytes(1)); |
129 assertSame(repeated0, proto.toBuilder().getRepeatedStringBytes(0)); | 127 assertSame(repeated0, proto.toBuilder().getRepeatedStringBytes(0)); |
130 assertSame(repeated1, proto.toBuilder().getRepeatedStringBytes(1)); | 128 assertSame(repeated1, proto.toBuilder().getRepeatedStringBytes(1)); |
131 } | 129 } |
132 } | 130 } |
OLD | NEW |