### Question:
StringOptionUtil { public static int countCodePoints(StringOption option) { Text text = option.get(); byte[] bytes = text.getBytes(); int len = text.getLength(); int index = 0; int count = 0; while (index < len) { byte b = bytes[index]; if ((b & 0b1000_0000) == 0) { index += 1; } else if ((b & 0b1110_0000) == 0b1100_0000) { index += 2; } else if ((b & 0b1111_0000) == 0b1110_0000) { index += 3; } else if ((b & 0b1111_1000) == 0b1111_0000) { index += 4; } else if ((b & 0b1111_1100) == 0b1111_1000) { index += 5; } else if ((b & 0b1111_1110) == 0b1111_1100) { index += 6; } else { break; } count++; } if (index != len) { throw new IllegalStateException(option.toString()); } return count; } private  StringOptionUtil(); static int countCodePoints(StringOption option); static Reader asReader(StringOption option); static void trim(StringOption option); static void append(StringOption target, StringOption contents); static void append(StringOption target, String contents); static void append(StringBuilder target, StringOption contents); static int parseInt(StringOption contents); static long parseLong(StringOption contents); static BigDecimal parseDecimal(StringOption contents); static void append(
            CharBuffer source, StringOption destination,
            CharsetEncoder encoder, ByteBuffer buffer); static final Charset ENCODING; }### Answer:
@Test public void countCodePoints() { Consumer<String> tester = s -> assertThat( StringOptionUtil.countCodePoints(new StringOption(s)), is((int) s.codePoints().count())); tester.accept(""); tester.accept("a"); tester.accept("Hello, world!"); tester.accept("\u00c0"); tester.accept(StringOptionTest.HELLO_JP); tester.accept(new StringBuilder() .appendCodePoint(0x1f37a) .appendCodePoint(0x1f363) .toString()); }