@Test
    public void testEncoding() {
        for (int c : TEST_CODEPOINTS) {
            byte[] encoded = Utf8.encode(c);
            String testCharacter = makeString(c);
            byte[] utf8 = Utf8.toBytes(testCharacter);
            assertArrayEquals(utf8, encoded);
        }
        byte[] stringAsUtf8 = Utf8.toBytes(TEST_STRING);
        byte[] handEncoded = new byte[Utf8.byteCount(TEST_STRING)];
        for (int i = 0, j = 0; i < TEST_STRING.length(); i = TEST_STRING.offsetByCodePoints(i, 1)) {
            j = Utf8.encode(TEST_STRING.codePointAt(i), handEncoded, j);
        }
        assertArrayEquals(stringAsUtf8, handEncoded);
    }
@author <a href="mailto:borud@yahoo-inc.com">Bjorn Borud</a>
@author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java