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

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

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 3 years, 12 months 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 12 matching lines...) Expand all
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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 junit.framework.TestCase;
34
33 import java.io.ByteArrayInputStream; 35 import java.io.ByteArrayInputStream;
34 import java.io.ByteArrayOutputStream; 36 import java.io.ByteArrayOutputStream;
35 import java.io.EOFException; 37 import java.io.EOFException;
36 import java.io.IOException; 38 import java.io.IOException;
37 import java.io.InputStream; 39 import java.io.InputStream;
38 import java.io.ObjectInputStream; 40 import java.io.ObjectInputStream;
39 import java.io.ObjectOutputStream; 41 import java.io.ObjectOutputStream;
40 import java.io.OutputStream; 42 import java.io.OutputStream;
41 import java.io.UnsupportedEncodingException; 43 import java.io.UnsupportedEncodingException;
42 import java.nio.ByteBuffer; 44 import java.nio.ByteBuffer;
43 import java.util.Arrays; 45 import java.util.Arrays;
44 import java.util.List; 46 import java.util.List;
45 import java.util.NoSuchElementException; 47 import java.util.NoSuchElementException;
46 import junit.framework.TestCase;
47 48
48 /** 49 /**
49 * Test {@code LiteralByteString} by setting up a reference string in {@link #se tUp()}. 50 * Test {@code LiteralByteString} by setting up a reference string in {@link #se tUp()}.
50 * This class is designed to be extended for testing extensions of {@code Litera lByteString} 51 * This class is designed to be extended for testing extensions of {@code Litera lByteString}
51 * such as {@code BoundedByteString}, see {@link BoundedByteStringTest}. 52 * such as {@code BoundedByteString}, see {@link BoundedByteStringTest}.
52 * 53 *
53 * @author carlanton@google.com (Carl Haverl) 54 * @author carlanton@google.com (Carl Haverl)
54 */ 55 */
55 public class LiteralByteStringTest extends TestCase { 56 public class LiteralByteStringTest extends TestCase {
56 protected static final String UTF_8 = "UTF-8"; 57 protected static final String UTF_8 = "UTF-8";
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 oos.writeObject(stringUnderTest); 536 oos.writeObject(stringUnderTest);
536 oos.close(); 537 oos.close();
537 byte[] pickled = out.toByteArray(); 538 byte[] pickled = out.toByteArray();
538 InputStream in = new ByteArrayInputStream(pickled); 539 InputStream in = new ByteArrayInputStream(pickled);
539 ObjectInputStream ois = new ObjectInputStream(in); 540 ObjectInputStream ois = new ObjectInputStream(in);
540 Object o = ois.readObject(); 541 Object o = ois.readObject();
541 assertTrue("Didn't get a ByteString back", o instanceof ByteString); 542 assertTrue("Didn't get a ByteString back", o instanceof ByteString);
542 assertEquals("Should get an equal ByteString back", stringUnderTest, o); 543 assertEquals("Should get an equal ByteString back", stringUnderTest, o);
543 } 544 }
544 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698