@Test
    public void testParse() throws Exception {
        Map<TopicPartition, List<Long>> res = DeleteRecordsCommand.parseOffsetJsonStringWithoutDedup(
            "{\"partitions\":[" +
                "{\"topic\":\"t\", \"partition\":0, \"offset\":0}," +
                "{\"topic\":\"t\", \"partition\":1, \"offset\":1, \"ignored\":\"field\"}," +
                "{\"topic\":\"t\", \"partition\":0, \"offset\":2}," +
                "{\"topic\":\"t\", \"partition\":0, \"offset\":0}" +
                "]}"
        );

        assertEquals(2, res.size());
        assertEquals(Arrays.asList(0L, 2L, 0L), res.get(new TopicPartition("t", 0)));
        assertEquals(Collections.singletonList(1L), res.get(new TopicPartition("t", 1)));
    }
Unit test of {@link DeleteRecordsCommand} tool.
tools/src/test/java/org/apache/kafka/tools/DeleteRecordsCommandTest.java