Using mocked streams with AVRO and schema registry in Kafka have been a problem.
Mocked streams works fine for StringSerdes, but using SpecificAvroSerde or Avro type did not work so well.
I have created a WireMock schema-registry client in SchemaRegistryAvroTest
You can simply extend to any of your test using extend
as show in PersonTopologyBuilderTest
For now there is no library available, you can use it via just copying the SchemaRegistryAvroTest
code in your code base.
You have to specifiy your schema registry url as s"http://localhost:${httpMockPort()}"
in your test and register your schema as follow:
register(s"input-topic-key", PersonKey.SCHEMA$)
register(s"input-topic-value", PersonRecord.SCHEMA$)
where input-topic
is the name of your input topic.
Using avro hugger to generate case classes from avro schema. PersonKey and PersonRecord are case classes generated by Avrohugger.