Bird
0
0

When testing a Kafka Streams topology that excludes records with null values, which TopologyTestDriver approach correctly verifies this filtering?

hard📝 Application Q8 of 15
Kafka - Advanced Stream Processing
When testing a Kafka Streams topology that excludes records with null values, which TopologyTestDriver approach correctly verifies this filtering?
ASend records including null values to input topic and assert output topic contains only non-null records
BSend only non-null records and check output topic for nulls
CSend null records and expect an exception from <code>TopologyTestDriver</code>
DSend null records and verify they appear unchanged in the output topic
Step-by-Step Solution
Solution:
  1. Step 1: Understand filtering behavior

    The topology should remove records with null values before forwarding.
  2. Step 2: Design test approach

    Send a mix of null and non-null records to the input topic.
  3. Step 3: Verify output

    Assert that the output topic contains only the non-null records, confirming filtering.
  4. Step 4: Evaluate options

    Send records including null values to input topic and assert output topic contains only non-null records correctly describes this approach. Send only non-null records and check output topic for nulls does not test filtering nulls. Send null records and expect an exception from TopologyTestDriver incorrectly expects exceptions. Send null records and verify they appear unchanged in the output topic contradicts filtering logic.
  5. Final Answer:

    Send records including null values to input topic and assert output topic contains only non-null records -> Option A
  6. Quick Check:

    Input nulls, output no nulls [OK]
Quick Trick: Input nulls, expect filtered output [OK]
Common Mistakes:
  • Not sending null records to test filtering
  • Expecting exceptions on null inputs
  • Assuming nulls pass through unchanged

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes