@Test
public void test4ByteEncodings() {

    StringBuilder sb = new StringBuilder();
    for (int i=0x10000; i<0x10000+100; i++) {
        sb.appendCodePoint(i);
    }
    // we remove 3 codepoints == 6 characters == 12 bytes, and then add back in the 1-byte '#'
    String result = ClassFileNameHandler.shortenPathComponent(sb.toString(), 8);
    Assert.assertEquals(400, sb.toString().getBytes(UTF8).length);
    Assert.assertEquals(389, result.getBytes(UTF8).length);
    Assert.assertEquals(195, result.length());
    // we remove 2 codepoints == 4 characters == 8 bytes, and then add back in the 1-byte '#'
    result = ClassFileNameHandler.shortenPathComponent(sb.toString(), 7);
    Assert.assertEquals(400, sb.toString().getBytes(UTF8).length);
    Assert.assertEquals(393, result.getBytes(UTF8).length);
    Assert.assertEquals(197, result.length());
}