@Test public void buildScanFromOffsetPredicateLessEq() {
    long constantOffset = 50;
    // columnOffset < constant
    Map
        actual =
        KafkaScanTrimmer.buildScanFromOffsetPredicate(fullHouse,
            PredicateLeaf.Operator.LESS_THAN_EQUALS,
            constantOffset,
            false,
            false);

    Map
        expected =
        Maps.transformValues(fullHouse,
            entry -> new KafkaInputSplit(Objects.requireNonNull(entry).getTopic(),
                entry.getPartition(),
                entry.getStartOffset(),
                Math.min(constantOffset + 1, entry.getEndOffset()),
                entry.getPath()));
    Assert.assertEquals(expected, actual);

    // columnOffset >= constant
    actual =
        KafkaScanTrimmer.buildScanFromOffsetPredicate(fullHouse,
            PredicateLeaf.Operator.LESS_THAN_EQUALS,
            constantOffset,
            true,
            false);

    expected =
        Maps.transformValues(fullHouse,
            entry -> new KafkaInputSplit(Objects.requireNonNull(entry).getTopic(),
                entry.getPartition(),
                Math.min(entry.getEndOffset(), Math.max(entry.getStartOffset(), constantOffset)),
                entry.getEndOffset(),
                entry.getPath()));
    Assert.assertEquals(expected, actual);

    // columnOffset > constant
    actual =
        KafkaScanTrimmer.buildScanFromOffsetPredicate(fullHouse,
            PredicateLeaf.Operator.LESS_THAN_EQUALS,
            constantOffset,
            false,
            true);

    expected =
        Maps.transformValues(fullHouse,
            entry -> new KafkaInputSplit(Objects.requireNonNull(entry).getTopic(),
                entry.getPartition(),
                Math.min(entry.getEndOffset(), Math.max(entry.getStartOffset(), constantOffset + 1)),
                entry.getEndOffset(),
                entry.getPath()));
    Assert.assertEquals(expected, actual);

    // columnOffset < constant
    actual =
        KafkaScanTrimmer.buildScanFromOffsetPredicate(fullHouse,
            PredicateLeaf.Operator.LESS_THAN_EQUALS,
            constantOffset,
            true,
            true);

    expected =
        Maps.transformValues(fullHouse,
            entry -> new KafkaInputSplit(Objects.requireNonNull(entry).getTopic(),
                entry.getPartition(),
                entry.getStartOffset(),
                Math.min(constantOffset, entry.getEndOffset()),
                entry.getPath()));
    Assert.assertEquals(expected, actual);
  }
Test Class for Kafka Trimmer Class.
kafka-handler/src/test/org/apache/hadoop/hive/kafka/KafkaScanTrimmerTest.java