@Test
public void findMatchingKafkaProducer(TestContext context) {

    Pattern pattern_1 = patternFrom("my.topic.*");
    Pattern pattern_2 = patternFrom(".+");
    repository.addKafkaProducer(new KafkaConfiguration(pattern_1, configs));
    repository.addKafkaProducer(new KafkaConfiguration(pattern_2, configs_2));
    //
    final Optional<Pair<KafkaProducer<String, String>, Pattern>> anyTopic = repository.findMatchingKafkaProducer("anyTopic");
    context.assertTrue(anyTopic.isPresent());
    context.assertEquals(pattern_2.pattern(), anyTopic.get().getRight().pattern());
    final Optional<Pair<KafkaProducer<String, String>, Pattern>> myTopicX = repository.findMatchingKafkaProducer("my.topic.x");
    context.assertTrue(myTopicX.isPresent());
    context.assertEquals(pattern_1.pattern(), myTopicX.get().getRight().pattern());
}