Reputation: 836
I'm using dropwizard and now i'm stuck. When i added new bundle, which give's me data from other source, my resource test cases are failing, because i dont know how to test my resource now. I've tried using mockito, but it didn't work anyway.
So here's my question - how to initialize bundle in my test class so my test objects would be able to get data from bundle correctly? Or maybe you would have other solutions to this problem?
Upvotes: 0
Views: 937
Reputation: 2610
For testing dropwizard resource use dropwizard-testing package. With this you can define class rule and start up your context for tests:
@ClassRule
public static final DropwizardAppRule<TestConfiguration> RULE =
new DropwizardAppRule<TestConfiguration>(MyApp.class, "my-app-config.yaml");
Also you can test resources without up context with ResourceTestRule class.
Upvotes: 1