@Test
    public void testTryAll() throws Throwable {
        Map<String, Object> recorded = new HashMap<>();

        Utils.tryAll(asList(
            recordingCallable(recorded, "valid-0", null),
            recordingCallable(recorded, null, new TestException("exception-1")),
            recordingCallable(recorded, "valid-2", null),
            recordingCallable(recorded, null, new TestException("exception-3"))
        ));
        Map<String, Object> expected = Utils.mkMap(
            mkEntry("valid-0", "valid-0"),
            mkEntry("exception-1", new TestException("exception-1")),
            mkEntry("valid-2", "valid-2"),
            mkEntry("exception-3", new TestException("exception-3"))
        );
        assertEquals(expected, recorded);

        recorded.clear();
        Utils.tryAll(asList(
            recordingCallable(recorded, "valid-0", null),
            recordingCallable(recorded, "valid-1", null)
        ));
        expected = Utils.mkMap(
            mkEntry("valid-0", "valid-0"),
            mkEntry("valid-1", "valid-1")
        );
        assertEquals(expected, recorded);

        recorded.clear();
        Utils.tryAll(asList(
            recordingCallable(recorded, null, new TestException("exception-0")),
            recordingCallable(recorded, null, new TestException("exception-1")))
        );
        expected = Utils.mkMap(
            mkEntry("exception-0", new TestException("exception-0")),
            mkEntry("exception-1", new TestException("exception-1"))
        );
        assertEquals(expected, recorded);
    }
Expectation setter for multiple reads where each one reads random bytes to the buffer.

@param channelMock           The mocked FileChannel object
@param bufferSize            The buffer size
@return Expected buffer string
@throws IOException          If an I/O error occurs
clients/src/test/java/org/apache/kafka/common/utils/UtilsTest.java