@Test
public void readUTF8MultiByteStringWithLengthCap() throws IOException {

    String textWithTwoBytesChars = "πππππ";
    TestInputStream stream = TestInputStream.withUTF8String(textWithTwoBytesChars);
    // We are cutting in half a string composed of two-bytes characters and uneven length. We are expecting to find
    // back the first half of the string terminated with a single replacement character.
    assertThat(DockerCloudUtils.readUTF8String(stream, 5)).isEqualTo(textWithTwoBytesChars.substring(0, 2) + "�");
}