### Question:
BinaryString extends LazyBinaryFormat<String> implements Comparable<BinaryString> { public byte[] getBytes() { ensureMaterialized(); return SegmentsUtil.getBytes(segments, offset, sizeInBytes); } BinaryString(); private  BinaryString(MemorySegment[] segments, int offset, int sizeInBytes); private  BinaryString(String javaObject); private  BinaryString(MemorySegment[] segments, int offset, int sizeInBytes, String javaObject); static BinaryString fromAddress(
			MemorySegment[] segments, int offset, int numBytes); static BinaryString fromString(String str); static BinaryString fromBytes(byte[] bytes); static BinaryString fromBytes(byte[] bytes, int offset, int numBytes); static BinaryString blankString(int length); int numChars(); byte byteAt(int index); byte[] getBytes(); @Override boolean equals(Object o); @Override String toString(); @Override void materialize(); BinaryString copy(); @Override int compareTo(@Nonnull BinaryString other); BinaryString substring(int beginIndex, int endIndex); boolean contains(final BinaryString s); boolean startsWith(final BinaryString prefix); boolean endsWith(final BinaryString suffix); BinaryString trim(); int indexOf(BinaryString str, int fromIndex); BinaryString toUpperCase(); BinaryString toLowerCase(); static final BinaryString EMPTY_UTF8; }### Answer:
@Test public void testEncodeWithIllegalCharacter() throws UnsupportedEncodingException { char[] chars = new char[] { 20122, 40635, 124, 38271, 34966, 124, 36830, 34915, 35033, 124, 55357, 124, 56407 }; String str = new String(chars); assertArrayEquals( str.getBytes("UTF-8"), StringUtf8Utils.encodeUTF8(str) ); }