StringBufferTest.java revision 89c1feb0a69a7707b271086e749975b3f7acacf7
1/* Licensed to the Apache Software Foundation (ASF) under one or more 2 * contributor license agreements. See the NOTICE file distributed with 3 * this work for additional information regarding copyright ownership. 4 * The ASF licenses this file to You under the Apache License, Version 2.0 5 * (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package org.apache.harmony.luni.tests.java.lang; 18 19import dalvik.annotation.TestInfo; 20import dalvik.annotation.TestLevel; 21import dalvik.annotation.TestTarget; 22import dalvik.annotation.TestTargetClass; 23 24import junit.framework.TestCase; 25 26import java.io.Serializable; 27 28import org.apache.harmony.testframework.serialization.SerializationTest; 29import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert; 30 31@TestTargetClass(StringBuffer.class) 32public class StringBufferTest extends TestCase { 33 34 /** 35 * @tests java.lang.StringBuffer#setLength(int) 36 */ 37 @TestInfo( 38 level = TestLevel.PARTIAL_OK, 39 purpose = "Verifies IndexOutOfBoundsException.", 40 targets = { 41 @TestTarget( 42 methodName = "setLength", 43 methodArgs = {int.class} 44 ) 45 }) 46 public void test_setLengthI() { 47 // Regression for HARMONY-90 48 StringBuffer buffer = new StringBuffer("abcde"); 49 try { 50 buffer.setLength(-1); 51 fail("Assert 0: IndexOutOfBoundsException must be thrown"); 52 } catch (IndexOutOfBoundsException e) { 53 // expected 54 } 55 } 56 57 /** 58 * @tests StringBuffer.StringBuffer(CharSequence); 59 */ 60 @TestInfo( 61 level = TestLevel.PARTIAL, 62 purpose = "Verifies NullPointerException.", 63 targets = { 64 @TestTarget( 65 methodName = "StringBuffer", 66 methodArgs = {java.lang.CharSequence.class} 67 ) 68 }) 69 public void test_constructorLjava_lang_CharSequence() { 70 try { 71 new StringBuffer((CharSequence) null); 72 fail("Assert 0: NPE must be thrown."); 73 } catch (NullPointerException e) {} 74 75 assertEquals("Assert 1: must equal 'abc'.", "abc", new StringBuffer((CharSequence)"abc").toString()); 76 } 77 @TestInfo( 78 level = TestLevel.COMPLETE, 79 purpose = "", 80 targets = { 81 @TestTarget( 82 methodName = "trimToSize", 83 methodArgs = {} 84 ) 85 }) 86 public void test_trimToSize() { 87 StringBuffer buffer = new StringBuffer(25); 88 buffer.append("abc"); 89 int origCapacity = buffer.capacity(); 90 buffer.trimToSize(); 91 int trimCapacity = buffer.capacity(); 92 assertTrue("Assert 0: capacity must be smaller.", trimCapacity < origCapacity); 93 assertEquals("Assert 1: length must still be 3", 3, buffer.length()); 94 assertEquals("Assert 2: value must still be 'abc'.", "abc", buffer.toString()); 95 } 96 97 /** 98 * @tests java.lang.StringBuffer.append(CharSequence) 99 */ 100 @TestInfo( 101 level = TestLevel.COMPLETE, 102 purpose = "", 103 targets = { 104 @TestTarget( 105 methodName = "append", 106 methodArgs = {java.lang.CharSequence.class} 107 ) 108 }) 109 public void test_appendLjava_lang_CharSequence() { 110 StringBuffer sb = new StringBuffer(); 111 assertSame(sb, sb.append((CharSequence) "ab")); 112 assertEquals("ab", sb.toString()); 113 sb.setLength(0); 114 assertSame(sb, sb.append((CharSequence) "cd")); 115 assertEquals("cd", sb.toString()); 116 sb.setLength(0); 117 assertSame(sb, sb.append((CharSequence) null)); 118 assertEquals("null", sb.toString()); 119 } 120 121 /** 122 * @tests java.lang.StringBuffer.append(CharSequence, int, int) 123 */ 124 @TestInfo( 125 level = TestLevel.PARTIAL, 126 purpose = "IndexOutOfBoundsException is not verified.", 127 targets = { 128 @TestTarget( 129 methodName = "append", 130 methodArgs = {java.lang.CharSequence.class, int.class, int.class} 131 ) 132 }) 133 @SuppressWarnings("cast") 134 public void test_appendLjava_lang_CharSequenceII() { 135 StringBuffer sb = new StringBuffer(); 136 assertSame(sb, sb.append((CharSequence) "ab", 0, 2)); 137 assertEquals("ab", sb.toString()); 138 sb.setLength(0); 139 assertSame(sb, sb.append((CharSequence) "cd", 0, 2)); 140 assertEquals("cd", sb.toString()); 141 sb.setLength(0); 142 assertSame(sb, sb.append((CharSequence) "abcd", 0, 2)); 143 assertEquals("ab", sb.toString()); 144 sb.setLength(0); 145 assertSame(sb, sb.append((CharSequence) "abcd", 2, 4)); 146 assertEquals("cd", sb.toString()); 147 sb.setLength(0); 148 assertSame(sb, sb.append((CharSequence) null, 0, 2)); 149 assertEquals("nu", sb.toString()); 150 } 151 152 /** 153 * @tests java.lang.StringBuffer.append(char[], int, int) 154 */ 155 @TestInfo( 156 level = TestLevel.PARTIAL, 157 purpose = "Verifies ArrayIndexOutOfBoundsException.", 158 targets = { 159 @TestTarget( 160 methodName = "append", 161 methodArgs = {char[].class, int.class, int.class} 162 ) 163 }) 164 public void test_append$CII_2() { 165 StringBuffer obj = new StringBuffer(); 166 try { 167 obj.append(new char[0], -1, -1); 168 fail("ArrayIndexOutOfBoundsException expected"); 169 } catch (ArrayIndexOutOfBoundsException e) { 170 // expected 171 } 172 } 173 174 /** 175 * @tests java.lang.StringBuffer.append(char[], int, int) 176 */ 177 @TestInfo( 178 level = TestLevel.PARTIAL, 179 purpose = "Verifies NullPointerException.", 180 targets = { 181 @TestTarget( 182 methodName = "append", 183 methodArgs = {char[].class, int.class, int.class} 184 ) 185 }) 186 public void test_append$CII_3() throws Exception { 187 StringBuffer obj = new StringBuffer(); 188 try { 189 obj.append((char[]) null, -1, -1); 190 fail("NullPointerException expected"); 191 } catch (NullPointerException e) { 192 // expected 193 } 194 } 195 196 /** 197 * @tests java.lang.StringBuffer.insert(int, CharSequence) 198 */ 199 @TestInfo( 200 level = TestLevel.COMPLETE, 201 purpose = "", 202 targets = { 203 @TestTarget( 204 methodName = "insert", 205 methodArgs = {int.class, java.lang.CharSequence.class} 206 ) 207 }) 208 public void test_insertILjava_lang_CharSequence() { 209 final String fixture = "0000"; 210 StringBuffer sb = new StringBuffer(fixture); 211 assertSame(sb, sb.insert(0, (CharSequence) "ab")); 212 assertEquals("ab0000", sb.toString()); 213 assertEquals(6, sb.length()); 214 215 sb = new StringBuffer(fixture); 216 assertSame(sb, sb.insert(2, (CharSequence) "ab")); 217 assertEquals("00ab00", sb.toString()); 218 assertEquals(6, sb.length()); 219 220 sb = new StringBuffer(fixture); 221 assertSame(sb, sb.insert(4, (CharSequence) "ab")); 222 assertEquals("0000ab", sb.toString()); 223 assertEquals(6, sb.length()); 224 225 sb = new StringBuffer(fixture); 226 assertSame(sb, sb.insert(4, (CharSequence) null)); 227 assertEquals("0000null", sb.toString()); 228 assertEquals(8, sb.length()); 229 230 try { 231 sb = new StringBuffer(fixture); 232 sb.insert(-1, (CharSequence) "ab"); 233 fail("no IOOBE, negative index"); 234 } catch (IndexOutOfBoundsException e) { 235 // Expected 236 } 237 238 try { 239 sb = new StringBuffer(fixture); 240 sb.insert(5, (CharSequence) "ab"); 241 fail("no IOOBE, index too large index"); 242 } catch (IndexOutOfBoundsException e) { 243 // Expected 244 } 245 } 246 247 /** 248 * @tests java.lang.StringBuffer.insert(int, CharSequence, int, int) 249 */ 250 @TestInfo( 251 level = TestLevel.COMPLETE, 252 purpose = "", 253 targets = { 254 @TestTarget( 255 methodName = "insert", 256 methodArgs = {int.class, java.lang.CharSequence.class, int.class, int.class} 257 ) 258 }) 259 @SuppressWarnings("cast") 260 public void test_insertILjava_lang_CharSequenceII() { 261 final String fixture = "0000"; 262 StringBuffer sb = new StringBuffer(fixture); 263 assertSame(sb, sb.insert(0, (CharSequence) "ab", 0, 2)); 264 assertEquals("ab0000", sb.toString()); 265 assertEquals(6, sb.length()); 266 267 sb = new StringBuffer(fixture); 268 assertSame(sb, sb.insert(0, (CharSequence) "ab", 0, 1)); 269 assertEquals("a0000", sb.toString()); 270 assertEquals(5, sb.length()); 271 272 sb = new StringBuffer(fixture); 273 assertSame(sb, sb.insert(2, (CharSequence) "ab", 0, 2)); 274 assertEquals("00ab00", sb.toString()); 275 assertEquals(6, sb.length()); 276 277 sb = new StringBuffer(fixture); 278 assertSame(sb, sb.insert(2, (CharSequence) "ab", 0, 1)); 279 assertEquals("00a00", sb.toString()); 280 assertEquals(5, sb.length()); 281 282 sb = new StringBuffer(fixture); 283 assertSame(sb, sb.insert(4, (CharSequence) "ab", 0, 2)); 284 assertEquals("0000ab", sb.toString()); 285 assertEquals(6, sb.length()); 286 287 sb = new StringBuffer(fixture); 288 assertSame(sb, sb.insert(4, (CharSequence) "ab", 0, 1)); 289 assertEquals("0000a", sb.toString()); 290 assertEquals(5, sb.length()); 291 292 sb = new StringBuffer(fixture); 293 assertSame(sb, sb.insert(4, (CharSequence) null, 0, 2)); 294 assertEquals("0000nu", sb.toString()); 295 assertEquals(6, sb.length()); 296 297 try { 298 sb = new StringBuffer(fixture); 299 sb.insert(-1, (CharSequence) "ab", 0, 2); 300 fail("no IOOBE, negative index"); 301 } catch (IndexOutOfBoundsException e) { 302 // Expected 303 } 304 305 try { 306 sb = new StringBuffer(fixture); 307 sb.insert(5, (CharSequence) "ab", 0, 2); 308 fail("no IOOBE, index too large index"); 309 } catch (IndexOutOfBoundsException e) { 310 // Expected 311 } 312 313 try { 314 sb = new StringBuffer(fixture); 315 sb.insert(5, (CharSequence) "ab", -1, 2); 316 fail("no IOOBE, negative offset"); 317 } catch (IndexOutOfBoundsException e) { 318 // Expected 319 } 320 321 try { 322 sb = new StringBuffer(fixture); 323 sb.insert(5, new char[] { 'a', 'b' }, 0, -1); 324 fail("no IOOBE, negative length"); 325 } catch (IndexOutOfBoundsException e) { 326 // Expected 327 } 328 329 try { 330 sb = new StringBuffer(fixture); 331 sb.insert(5, new char[] { 'a', 'b' }, 0, 3); 332 fail("no IOOBE, too long"); 333 } catch (IndexOutOfBoundsException e) { 334 // Expected 335 } 336 } 337 338 /** 339 * @tests java.lang.StringBuffer.insert(int, char) 340 */ 341 @TestInfo( 342 level = TestLevel.PARTIAL_OK, 343 purpose = "Verifies ArrayIndexOutOfBoundsException.", 344 targets = { 345 @TestTarget( 346 methodName = "insert", 347 methodArgs = {int.class, char.class} 348 ) 349 }) 350 public void test_insertIC() { 351 StringBuffer obj = new StringBuffer(); 352 try { 353 obj.insert(-1, ' '); 354 fail("ArrayIndexOutOfBoundsException expected"); 355 } catch (ArrayIndexOutOfBoundsException e) { 356 // expected 357 } 358 } 359 360 /** 361 * @tests java.lang.StringBuffer.appendCodePoint(int)' 362 */ 363 @TestInfo( 364 level = TestLevel.COMPLETE, 365 purpose = "", 366 targets = { 367 @TestTarget( 368 methodName = "appendCodePoint", 369 methodArgs = {int.class} 370 ) 371 }) 372 public void test_appendCodePointI() { 373 StringBuffer sb = new StringBuffer(); 374 sb.appendCodePoint(0x10000); 375 assertEquals("\uD800\uDC00", sb.toString()); 376 sb.append("fixture"); 377 assertEquals("\uD800\uDC00fixture", sb.toString()); 378 sb.appendCodePoint(0x00010FFFF); 379 assertEquals("\uD800\uDC00fixture\uDBFF\uDFFF", sb.toString()); 380 } 381 382 /** 383 * @tests java.lang.StringBuffer.codePointAt(int) 384 */ 385 @TestInfo( 386 level = TestLevel.COMPLETE, 387 purpose = "", 388 targets = { 389 @TestTarget( 390 methodName = "codePointAt", 391 methodArgs = {int.class} 392 ) 393 }) 394 public void test_codePointAtI() { 395 StringBuffer sb = new StringBuffer("abc"); 396 assertEquals('a', sb.codePointAt(0)); 397 assertEquals('b', sb.codePointAt(1)); 398 assertEquals('c', sb.codePointAt(2)); 399 400 sb = new StringBuffer("\uD800\uDC00"); 401 assertEquals(0x10000, sb.codePointAt(0)); 402 assertEquals('\uDC00', sb.codePointAt(1)); 403 404 try { 405 sb.codePointAt(-1); 406 fail("No IOOBE on negative index."); 407 } catch (IndexOutOfBoundsException e) { 408 409 } 410 411 try { 412 sb.codePointAt(sb.length()); 413 fail("No IOOBE on index equal to length."); 414 } catch (IndexOutOfBoundsException e) { 415 416 } 417 418 try { 419 sb.codePointAt(sb.length() + 1); 420 fail("No IOOBE on index greater than length."); 421 } catch (IndexOutOfBoundsException e) { 422 423 } 424 } 425 426 /** 427 * @tests java.lang.StringBuffer.codePointBefore(int) 428 */ 429 @TestInfo( 430 level = TestLevel.COMPLETE, 431 purpose = "", 432 targets = { 433 @TestTarget( 434 methodName = "codePointBefore", 435 methodArgs = {int.class} 436 ) 437 }) 438 public void test_codePointBeforeI() { 439 StringBuffer sb = new StringBuffer("abc"); 440 assertEquals('a', sb.codePointBefore(1)); 441 assertEquals('b', sb.codePointBefore(2)); 442 assertEquals('c', sb.codePointBefore(3)); 443 444 sb = new StringBuffer("\uD800\uDC00"); 445 assertEquals(0x10000, sb.codePointBefore(2)); 446 assertEquals('\uD800', sb.codePointBefore(1)); 447 448 try { 449 sb.codePointBefore(0); 450 fail("No IOOBE on zero index."); 451 } catch (IndexOutOfBoundsException e) { 452 453 } 454 455 try { 456 sb.codePointBefore(-1); 457 fail("No IOOBE on negative index."); 458 } catch (IndexOutOfBoundsException e) { 459 460 } 461 462 try { 463 sb.codePointBefore(sb.length() + 1); 464 fail("No IOOBE on index greater than length."); 465 } catch (IndexOutOfBoundsException e) { 466 467 } 468 } 469 470 /** 471 * @tests java.lang.StringBuffer.codePointCount(int, int) 472 */ 473 @TestInfo( 474 level = TestLevel.COMPLETE, 475 purpose = "", 476 targets = { 477 @TestTarget( 478 methodName = "codePointCount", 479 methodArgs = {int.class, int.class} 480 ) 481 }) 482 public void test_codePointCountII() { 483 assertEquals(1, new StringBuffer("\uD800\uDC00").codePointCount(0, 2)); 484 assertEquals(1, new StringBuffer("\uD800\uDC01").codePointCount(0, 2)); 485 assertEquals(1, new StringBuffer("\uD801\uDC01").codePointCount(0, 2)); 486 assertEquals(1, new StringBuffer("\uDBFF\uDFFF").codePointCount(0, 2)); 487 488 assertEquals(3, new StringBuffer("a\uD800\uDC00b").codePointCount(0, 4)); 489 assertEquals(4, new StringBuffer("a\uD800\uDC00b\uD800").codePointCount(0, 5)); 490 491 StringBuffer sb = new StringBuffer("abc"); 492 try { 493 sb.codePointCount(-1, 2); 494 fail("No IOOBE for negative begin index."); 495 } catch (IndexOutOfBoundsException e) { 496 497 } 498 499 try { 500 sb.codePointCount(0, 4); 501 fail("No IOOBE for end index that's too large."); 502 } catch (IndexOutOfBoundsException e) { 503 504 } 505 506 try { 507 sb.codePointCount(3, 2); 508 fail("No IOOBE for begin index larger than end index."); 509 } catch (IndexOutOfBoundsException e) { 510 511 } 512 } 513 514 /** 515 * @tests java.lang.StringBuffer.getChars(int, int, char[], int) 516 */ 517 @TestInfo( 518 level = TestLevel.PARTIAL, 519 purpose = "Verifies IndexOutOfBoundsException.", 520 targets = { 521 @TestTarget( 522 methodName = "getChars", 523 methodArgs = {int.class, int.class, char[].class, int.class} 524 ) 525 }) 526 public void test_getCharsII$CI() { 527 StringBuffer obj = new StringBuffer(); 528 try { 529 obj.getChars(0, 0, new char[0], -1); 530// TODO(Fixed) According to spec this should be IndexOutOfBoundsException. 531// fail("ArrayIndexOutOfBoundsException expected"); 532// } catch (ArrayIndexOutOfBoundsException e) { 533 fail("IndexOutOfBoundsException expected"); 534 } catch (IndexOutOfBoundsException e) { 535 // expected 536 } 537 } 538 539 /** 540 * @tests java.lang.StringBuffer.offsetByCodePoints(int, int)' 541 */ 542 @TestInfo( 543 level = TestLevel.COMPLETE, 544 purpose = "", 545 targets = { 546 @TestTarget( 547 methodName = "offsetByCodePoints", 548 methodArgs = {int.class, int.class} 549 ) 550 }) 551 public void test_offsetByCodePointsII() { 552 int result = new StringBuffer("a\uD800\uDC00b").offsetByCodePoints(0, 2); 553 assertEquals(3, result); 554 555 result = new StringBuffer("abcd").offsetByCodePoints(3, -1); 556 assertEquals(2, result); 557 558 result = new StringBuffer("a\uD800\uDC00b").offsetByCodePoints(0, 3); 559 assertEquals(4, result); 560 561 result = new StringBuffer("a\uD800\uDC00b").offsetByCodePoints(3, -1); 562 assertEquals(1, result); 563 564 result = new StringBuffer("a\uD800\uDC00b").offsetByCodePoints(3, 0); 565 assertEquals(3, result); 566 567 result = new StringBuffer("\uD800\uDC00bc").offsetByCodePoints(3, 0); 568 assertEquals(3, result); 569 570 result = new StringBuffer("a\uDC00bc").offsetByCodePoints(3, -1); 571 assertEquals(2, result); 572 573 result = new StringBuffer("a\uD800bc").offsetByCodePoints(3, -1); 574 assertEquals(2, result); 575 576 StringBuffer sb = new StringBuffer("abc"); 577 try { 578 sb.offsetByCodePoints(-1, 1); 579 fail("No IOOBE for negative index."); 580 } catch (IndexOutOfBoundsException e) { 581 582 } 583 584 try { 585 sb.offsetByCodePoints(0, 4); 586 fail("No IOOBE for offset that's too large."); 587 } catch (IndexOutOfBoundsException e) { 588 589 } 590 591 try { 592 sb.offsetByCodePoints(3, -4); 593 fail("No IOOBE for offset that's too small."); 594 } catch (IndexOutOfBoundsException e) { 595 596 } 597 598 try { 599 sb.offsetByCodePoints(3, 1); 600 fail("No IOOBE for index that's too large."); 601 } catch (IndexOutOfBoundsException e) { 602 603 } 604 605 try { 606 sb.offsetByCodePoints(4, -1); 607 fail("No IOOBE for index that's too large."); 608 } catch (IndexOutOfBoundsException e) { 609 610 } 611 } 612 613 /** 614 * @tests {@link java.lang.StringBuffer#indexOf(String, int)} 615 */ 616 @TestInfo( 617 level = TestLevel.COMPLETE, 618 purpose = "", 619 targets = { 620 @TestTarget( 621 methodName = "indexOf", 622 methodArgs = {java.lang.String.class, int.class} 623 ) 624 }) 625 @SuppressWarnings("nls") 626 public void test_IndexOfStringInt() { 627 final String fixture = "0123456789"; 628 StringBuffer sb = new StringBuffer(fixture); 629 assertEquals(0, sb.indexOf("0")); 630 assertEquals(0, sb.indexOf("012")); 631 assertEquals(-1, sb.indexOf("02")); 632 assertEquals(8, sb.indexOf("89")); 633 634 assertEquals(0, sb.indexOf("0"), 0); 635 assertEquals(0, sb.indexOf("012"), 0); 636 assertEquals(-1, sb.indexOf("02"), 0); 637 assertEquals(8, sb.indexOf("89"), 0); 638 639 assertEquals(-1, sb.indexOf("0"), 5); 640 assertEquals(-1, sb.indexOf("012"), 5); 641 assertEquals(-1, sb.indexOf("02"), 0); 642 assertEquals(8, sb.indexOf("89"), 5); 643 644 try { 645 sb.indexOf(null, 0); 646 fail("Should throw a NullPointerExceptionE"); 647 } catch (NullPointerException e) { 648 // Expected 649 } 650 } 651 652 /** 653 * @tests {@link java.lang.StringBuffer#lastIndexOf(String, int)} 654 */ 655 @TestInfo( 656 level = TestLevel.COMPLETE, 657 purpose = "", 658 targets = { 659 @TestTarget( 660 methodName = "lastIndexOf", 661 methodArgs = {java.lang.String.class, int.class} 662 ) 663 }) 664 @SuppressWarnings("nls") 665 public void test_lastIndexOfLjava_lang_StringI() { 666 final String fixture = "0123456789"; 667 StringBuffer sb = new StringBuffer(fixture); 668 assertEquals(0, sb.lastIndexOf("0")); 669 assertEquals(0, sb.lastIndexOf("012")); 670 assertEquals(-1, sb.lastIndexOf("02")); 671 assertEquals(8, sb.lastIndexOf("89")); 672 673 assertEquals(0, sb.lastIndexOf("0"), 0); 674 assertEquals(0, sb.lastIndexOf("012"), 0); 675 assertEquals(-1, sb.lastIndexOf("02"), 0); 676 assertEquals(8, sb.lastIndexOf("89"), 0); 677 678 assertEquals(-1, sb.lastIndexOf("0"), 5); 679 assertEquals(-1, sb.lastIndexOf("012"), 5); 680 assertEquals(-1, sb.lastIndexOf("02"), 0); 681 assertEquals(8, sb.lastIndexOf("89"), 5); 682 683 try { 684 sb.lastIndexOf(null, 0); 685 fail("Should throw a NullPointerException"); 686 } catch (NullPointerException e) { 687 // Expected 688 } 689 } 690 691 // comparator for StringBuffer objects 692 private static final SerializableAssert STRING_BUFFER_COMPARATOR = new SerializableAssert() { 693 public void assertDeserialized(Serializable initial, 694 Serializable deserialized) { 695 696 StringBuffer init = (StringBuffer) initial; 697 StringBuffer desr = (StringBuffer) deserialized; 698 699 // serializable fields are: 'count', 'shared', 'value' 700 // serialization of 'shared' is not verified 701 // 'count' + 'value' should result in required string 702 assertEquals("toString", init.toString(), desr.toString()); 703 } 704 }; 705 706 /** 707 * @tests serialization/deserialization. 708 */ 709 @TestInfo( 710 level = TestLevel.COMPLETE, 711 purpose = "Verifies serialization/deserialization compatibility.", 712 targets = { 713 @TestTarget( 714 methodName = "!SerializationSelf", 715 methodArgs = {} 716 ) 717 }) 718 public void testSerializationSelf() throws Exception { 719 720 SerializationTest.verifySelf(new StringBuffer("0123456789"), 721 STRING_BUFFER_COMPARATOR); 722 } 723 724 /** 725 * @tests serialization/deserialization compatibility with RI. 726 */ 727 @TestInfo( 728 level = TestLevel.COMPLETE, 729 purpose = "Verifies serialization/deserialization compatibility.", 730 targets = { 731 @TestTarget( 732 methodName = "!SerializationGolden", 733 methodArgs = {} 734 ) 735 }) 736 public void testSerializationCompatibility() throws Exception { 737 738 SerializationTest.verifyGolden(this, new StringBuffer("0123456789"), 739 STRING_BUFFER_COMPARATOR); 740 } 741} 742