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 import static java.util.Arrays.asList; | 33 import static java.util.Arrays.asList; |
34 | 34 |
35 import junit.framework.TestCase; | |
36 | |
37 import java.util.ArrayList; | 35 import java.util.ArrayList; |
| 36 import java.util.Collections; |
38 import java.util.ConcurrentModificationException; | 37 import java.util.ConcurrentModificationException; |
39 import java.util.Iterator; | 38 import java.util.Iterator; |
40 import java.util.List; | 39 import java.util.List; |
| 40 import junit.framework.TestCase; |
41 | 41 |
42 /** | 42 /** |
43 * Tests for {@link LazyStringArrayList}. | 43 * Tests for {@link LazyStringArrayList}. |
44 * | 44 * |
45 * @author jonp@google.com (Jon Perlow) | 45 * @author jonp@google.com (Jon Perlow) |
46 */ | 46 */ |
47 public class LazyStringArrayListTest extends TestCase { | 47 public class LazyStringArrayListTest extends TestCase { |
48 | 48 |
49 private static String STRING_A = "A"; | 49 private static String STRING_A = "A"; |
50 private static String STRING_B = "B"; | 50 private static String STRING_B = "B"; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 try { | 228 try { |
229 list.add(BYTE_STRING_A); | 229 list.add(BYTE_STRING_A); |
230 fail(); | 230 fail(); |
231 } catch (UnsupportedOperationException e) { | 231 } catch (UnsupportedOperationException e) { |
232 // expected | 232 // expected |
233 } | 233 } |
234 | 234 |
235 try { | 235 try { |
236 list.addAllByteArray(asList(BYTE_STRING_A.toByteArray())); | 236 list.addAllByteArray(Collections.singletonList(BYTE_STRING_A.toByteArray()
)); |
237 fail(); | 237 fail(); |
238 } catch (UnsupportedOperationException e) { | 238 } catch (UnsupportedOperationException e) { |
239 // expected | 239 // expected |
240 } | 240 } |
241 | 241 |
242 try { | 242 try { |
243 list.addAllByteString(asList(BYTE_STRING_A)); | 243 list.addAllByteString(asList(BYTE_STRING_A)); |
244 fail(); | 244 fail(); |
245 } catch (UnsupportedOperationException e) { | 245 } catch (UnsupportedOperationException e) { |
246 // expected | 246 // expected |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 353 } |
354 | 354 |
355 try { | 355 try { |
356 list.set(0, value); | 356 list.set(0, value); |
357 fail(); | 357 fail(); |
358 } catch (UnsupportedOperationException e) { | 358 } catch (UnsupportedOperationException e) { |
359 // expected | 359 // expected |
360 } | 360 } |
361 } | 361 } |
362 } | 362 } |
OLD | NEW |