I have a Quarkus application, and I want to test one part of it. That part is using kafka streams, and I do not want to connect to the network during testing, so I am not using the @QuarkusTest flag.
Instead I would use MockProcessorContext and the KafkaStreams junit testing approach.
As I am using a Transformer object, I need to use the same topic name throughout, so I have put the topics in an @ConfigProperties class (simplified example):
@ConfigProperties(prefix = "test")
public class AppConfiguration {
public TopicsConfig topics;
public StoresConfig stores;
public static class TopicsConfig {
public String first = "first-topic";
public String second = "second-topic";
}
public static class StoresConfig {
public String first = "first-store";
}
}
Then in my junit test class I @Inject this as I would normally in my application
@Inject
AppConfiguration config
The problem I have is that when I come to use it in my setup function, it is always null.
@BeforeEach
public void setUp() {
config == null
}
I do not know how to get around this - I don't want to use @QuarkusTest as I do not need to run the application and connect to all my servers.
Help and advice please!