void (String[][] expected) { int runningIndex = 0; for (int chunkIndex = 0; chunkIndex < expected.length; chunkIndex++) { String[] chunk = expected[chunkIndex]; final List<String> expectedChunkList = new ArrayList<>(Arrays.asList(chunk)); int nextIndex = runningIndex + chunk.length; assertTrue("Expected chunk " + expectedChunkList.toString(), nextIndex <= myLog.size()); final List<String> actualChunkList = new ArrayList<>(myLog.subList(runningIndex, nextIndex)); Collections.sort(expectedChunkList); Collections.sort(actualChunkList); assertEquals("Chunk " + chunkIndex, expectedChunkList.toString(), actualChunkList.toString()); runningIndex = nextIndex; } assertEquals("More events than needed", runningIndex, myLog.size()); }