Hi everybody,
I am using vertx unit in combination with JUnit for my unit tests.
I have a MainVerticle, which deploys a SubVerticle.
In both verticles, I query some value from config(). When started from the IDE or the fat JAR, I supply the configuration with a -conf /some/path/config.json parameter.
When I run within a JUnit test which tests the MainVerticle, how can I set such a global configuration? If I create a DeploymentOptions() and pass them to the vertx.deploy(MainVerticle.class.getName(), options, handler), they are not automatically forwarded to the SubVerticle, since I don't pass any options when deploying it from inside the MainVerticle.
As a workaround, I deploy the SubVerticle from within the MainVerticle.start(...) like this:
vertx.deployVerticle(FetchItemPricesVerticle.class.getName(), new DeploymentOptions().setConfig(config()));
This seems like a hack to me, so my question is: How to simulate a global config in a JUnit test?
Thanks for any suggestions
Dominik