From cabb3efeace47b47e149374147d574d83b7ad831 Mon Sep 17 00:00:00 2001 From: Tatsunori Uchino Date: Sat, 31 Jan 2026 22:28:43 +0900 Subject: [PATCH] Split testcases for `StringBuilder.codePointCount` --- .../lang/StringBuilder/Supplementary.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/test/jdk/java/lang/StringBuilder/Supplementary.java b/test/jdk/java/lang/StringBuilder/Supplementary.java index 6df1d5e67b6..801c86e8d54 100644 --- a/test/jdk/java/lang/StringBuilder/Supplementary.java +++ b/test/jdk/java/lang/StringBuilder/Supplementary.java @@ -215,13 +215,13 @@ public class Supplementary { } /** - * Test codePointCount(int, int) & codePointCount() + * Test codePointCount(int, int) * * This test case assumes that * Character.codePointCount(CharSequence, int, int) works * correctly. */ - static void test5() { + static void testCodePointCountTwoArgs() { for (int i = 0; i < input.length; i++) { String s = input[i]; StringBuilder sb = new StringBuilder(s); @@ -239,11 +239,6 @@ public class Supplementary { result, expected); } - - int result = sb.codePointCount(); - int expected = Character.codePointCount(sb, 0, sb.length()); - check(result != expected, "codePointCount()", result, expected); - // test exceptions testCodePointCount(null, 0, 0, NullPointerException.class); testCodePointCount(sb, -1, length, IndexOutOfBoundsException.class); @@ -252,6 +247,24 @@ public class Supplementary { } } + /** + * Test codePointCount() + * + * This test case assumes that + * Character.codePointCount(CharSequence) works + * correctly. + */ + static void testCodePointCountNoArg() { + for (int i = 0; i < input.length; i++) { + String s = input[i]; + StringBuilder sb = new StringBuilder(s); + + int result = sb.codePointCount(); + int expected = Character.codePointCount(sb, 0, sb.length()); + check(result != expected, "codePointCount()", result, expected) + } + } + /** * Test offsetByCodePoints(int, int) *