Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: third_party/protobuf/java/core/src/test/java/com/google/protobuf/ByteStringTest.java

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
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 import com.google.protobuf.ByteString.Output; 33 import com.google.protobuf.ByteString.Output;
34
35 import junit.framework.TestCase;
36
37 import java.io.ByteArrayInputStream; 34 import java.io.ByteArrayInputStream;
38 import java.io.ByteArrayOutputStream; 35 import java.io.ByteArrayOutputStream;
39 import java.io.IOException; 36 import java.io.IOException;
40 import java.io.InputStream; 37 import java.io.InputStream;
41 import java.io.OutputStream; 38 import java.io.OutputStream;
42 import java.lang.reflect.Field; 39 import java.lang.reflect.Field;
43 import java.nio.ByteBuffer; 40 import java.nio.ByteBuffer;
44 import java.nio.charset.Charset; 41 import java.nio.charset.Charset;
45 import java.util.ArrayList; 42 import java.util.ArrayList;
46 import java.util.Arrays; 43 import java.util.Arrays;
47 import java.util.Iterator; 44 import java.util.Iterator;
48 import java.util.List; 45 import java.util.List;
49 import java.util.NoSuchElementException; 46 import java.util.NoSuchElementException;
50 import java.util.Random; 47 import java.util.Random;
48 import junit.framework.TestCase;
51 49
52 /** 50 /**
53 * Test methods with implementations in {@link ByteString}, plus do some top-lev el "integration" 51 * Test methods with implementations in {@link ByteString}, plus do some top-lev el "integration"
54 * tests. 52 * tests.
55 * 53 *
56 * @author carlanton@google.com (Carl Haverl) 54 * @author carlanton@google.com (Carl Haverl)
57 */ 55 */
58 public class ByteStringTest extends TestCase { 56 public class ByteStringTest extends TestCase {
59 57
60 private static final Charset UTF_16 = Charset.forName("UTF-16"); 58 private static final Charset UTF_16 = Charset.forName("UTF-16");
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 public void testByteArrayCopier() throws Exception { 763 public void testByteArrayCopier() throws Exception {
766 Field field = ByteString.class.getDeclaredField("byteArrayCopier"); 764 Field field = ByteString.class.getDeclaredField("byteArrayCopier");
767 field.setAccessible(true); 765 field.setAccessible(true);
768 Object byteArrayCopier = field.get(null); 766 Object byteArrayCopier = field.get(null);
769 assertNotNull(byteArrayCopier); 767 assertNotNull(byteArrayCopier);
770 assertTrue( 768 assertTrue(
771 byteArrayCopier.toString(), 769 byteArrayCopier.toString(),
772 byteArrayCopier.getClass().getSimpleName().endsWith("ArraysByteArrayCopi er")); 770 byteArrayCopier.getClass().getSimpleName().endsWith("ArraysByteArrayCopi er"));
773 } 771 }
774 } 772 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698