To unit-test producer logic without connecting to a real broker, which Kafka client testing utility should a developer use?
- A. MockProducer✓ Correct
- B. TopologyTestDriver
- C. A production Kafka cluster
- D. AdminClient
Explanation
MockProducer implements the Producer interface in-memory, recording sent records so you can assert on producer behavior without a broker. TopologyTestDriver (B) is for Streams topologies, a production cluster (C) isn't a unit-test tool, and AdminClient (D) manages topics/configs.