14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import org.testng.annotations.DataProvider;
25 import org.testng.annotations.Test;
26
27 import static jdk.test.lib.util.SerializationUtils.*;
28 import static org.testng.Assert.assertEquals;
29
30 /*
31 * @test
32 * @bug 8077559
33 * @library /test/lib
34 * @summary Tests Compact String. This one is testing String serialization
35 * among -XX:+CompactStrings/-XX:-CompactStrings/LegacyString
36 * @run testng/othervm -XX:+CompactStrings SerializationTest
37 * @run testng/othervm -XX:-CompactStrings SerializationTest
38 */
39
40 public class SerializationTest {
41 @DataProvider
42 public Object[][] provider() {
43 return new Object[][] {
44 // every byte array is serialized from corresponding String object
45 // by previous JDK(build 1.8.0_45-b14).
46 new Object[] { "", new byte[] { -84, -19, 0, 5, 116, 0, 0 } },
47 new Object[] { "A", new byte[] { -84, -19, 0, 5, 116, 0, 1, 65 } },
48 new Object[] { "AB", new byte[] { -84, -19, 0, 5, 116, 0, 2, 65, 66 } },
49 new Object[] { "abcdefghijk",
50 new byte[] {-84, -19, 0, 5, 116, 0, 11, 97, 98, 99, 100, 101,
51 102, 103, 104, 105, 106, 107 } },
52 new Object[] { "\uff21", new byte[] { -84, -19, 0, 5, 116, 0, 3, -17, -68, -95 } },
53 new Object[] { "\uff21\uff22", new byte[] { -84, -19, 0, 5, 116, 0, 6, -17, -68,
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import org.testng.annotations.DataProvider;
25 import org.testng.annotations.Test;
26
27 import static jdk.test.lib.util.SerializationUtils.*;
28 import static org.testng.Assert.assertEquals;
29
30 /*
31 * @test
32 * @bug 8077559
33 * @library /test/lib
34 * @build jdk.test.lib.util.SerializationUtils
35 * @summary Tests Compact String. This one is testing String serialization
36 * among -XX:+CompactStrings/-XX:-CompactStrings/LegacyString
37 * @run testng/othervm -XX:+CompactStrings SerializationTest
38 * @run testng/othervm -XX:-CompactStrings SerializationTest
39 */
40
41 public class SerializationTest {
42 @DataProvider
43 public Object[][] provider() {
44 return new Object[][] {
45 // every byte array is serialized from corresponding String object
46 // by previous JDK(build 1.8.0_45-b14).
47 new Object[] { "", new byte[] { -84, -19, 0, 5, 116, 0, 0 } },
48 new Object[] { "A", new byte[] { -84, -19, 0, 5, 116, 0, 1, 65 } },
49 new Object[] { "AB", new byte[] { -84, -19, 0, 5, 116, 0, 2, 65, 66 } },
50 new Object[] { "abcdefghijk",
51 new byte[] {-84, -19, 0, 5, 116, 0, 11, 97, 98, 99, 100, 101,
52 102, 103, 104, 105, 106, 107 } },
53 new Object[] { "\uff21", new byte[] { -84, -19, 0, 5, 116, 0, 3, -17, -68, -95 } },
54 new Object[] { "\uff21\uff22", new byte[] { -84, -19, 0, 5, 116, 0, 6, -17, -68,
|