Bird
0
0

Which of the following is the correct way to create a TopologyTestDriver instance in Java?

easy📝 Syntax Q12 of 15
Kafka - Advanced Stream Processing
Which of the following is the correct way to create a TopologyTestDriver instance in Java?
ATopologyTestDriver.create(topology, properties);
Bnew TopologyTestDriver(topology, properties);
CTopologyTestDriver.start(topology, properties);
Dnew TopologyTestDriver(properties, topology);
Step-by-Step Solution
Solution:
  1. Step 1: Recall the constructor signature

    The constructor takes the topology first, then the properties.
  2. Step 2: Check each option

    new TopologyTestDriver(topology, properties); matches the correct constructor call. Options B and C use non-existent static methods. new TopologyTestDriver(properties, topology); reverses the argument order.
  3. Final Answer:

    new TopologyTestDriver(topology, properties); -> Option B
  4. Quick Check:

    Constructor = topology, properties [OK]
Quick Trick: Constructor order: topology first, then properties [OK]
Common Mistakes:
MISTAKES
  • Using static methods instead of constructor
  • Swapping argument order
  • Calling non-existent start or create methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes