public void testBuildRepeatedStringWithBadUtf8() throws Exception { try { StringWrapper.newBuilder().addRepBytes(NON_UTF8_BYTE_STRING); fail("Expected IllegalArgumentException for non UTF-8 byte string."); } catch (IllegalArgumentException exception) { assertEquals("Byte string is not UTF-8.", exception.getMessage()); } }
public void testBuildRequiredStringWithGoodUtf8() throws Exception { assertEquals( UTF8_BYTE_STRING_TEXT, StringWrapper.newBuilder().setReqBytes(UTF8_BYTE_STRING).getReq()); }