kafka-streams-test-wrapper

The wrapper makes easy test process for kafka-streams

This project is maintained by besok

Description:

StreamsTestHelper makes easy test process for kafka-streams. It based on TopologyTestDriver and work in case if you need kafka streams, avro classes as model and schema-registry.

Properties:

Generate and send records
    List<ConsumerRecord<byte[], byte[]>> records = StreamsTestHelper
            .run(builder, properties)
            .sender("topic", () -> null, () -> newValue())
            .generate(10);
     
    StreamsTestHelper
        .run(builder, properties)
        .sender("topic", () -> null, () -> newValue())
        .send(10);       
Send and receive records
    ProducerRecord<Key, Value> record = StreamsTestHelper
        .run(builder, properties)
        .sender("topic", () -> null, () -> newValue())
        .send()
        .pipe()
        .receiver("topic-next", Key.class, Value.class)
        .read();        
           
    Optional<Value> record = StreamsTestHelper
        .run(builder, properties)
        .sender("topic", () -> null, () -> newValue())
        .send(10)
        .pipe()
        .keeper("topic-next",Key.class,Value.class)
        .find(new Key("1")); 
Avro generation
    List<ConsumerRecord<byte[], byte[]>> records = StreamsTestHelper
            .run(builder, properties)
            .sender("topic", Key.class, Value.class)
            .generate(10);
            
    List<ConsumerRecord<byte[], byte[]>> records = StreamsTestHelper
            .run(builder, properties)
            .sender("topic", Key.class, Value.class)
            .rule(
                field -> field.name().equals("field"), 
                v -> 10, false) 
            .send(10); 
  
    List<ConsumerRecord<byte[], byte[]>> records = StreamsTestHelper
            .run(builder, properties)
            .sender("topic", Key.class, Value.class)
            .rule(name("field"), constant(10), false) 
            .send(10);                    
                                             

License

This project is licensed under the terms of the MIT license.