@Test
public void testInvalidUTF8Truncated() throws Exception {

  // Truncated CAT FACE character -- this is a 4-byte sequence, but we
  // only have the first three bytes.
  byte[] truncated = new byte[] {
      (byte)0xF0, (byte)0x9F, (byte)0x90 };
  try {
    UTF8.fromBytes(truncated);
    fail("did not throw an exception");
  } catch (UTFDataFormatException utfde) {
    GenericTestUtils.assertExceptionContains(
        "Truncated UTF8 at f09f90", utfde);
  }
}