Closed Sch3lp closed 9 years ago
Attempted writing an IntegrationTest using the DropwizardAppRule, and we'd need to somehow be able to register a Resource that would be "configurable" during test run. This won't work since it's an @ClassRule and the DropwizardApp is already up and running even when you enter your own @BeforeClass initialization block.
So, the only way we can integration test this is by checking all specific Exceptions that can get thrown on all specific resource methods. Or be content with just unit testing the ExceptionToJSONMapper which'll do the actual work anyway. We could add to that a unit test that checks that this mapper is registered as a provider on a running FiazardApp instance.
An Error should look like this:
All thrown exceptions should be transformed into an error like that. We should have specific FiazardException classes to represent specific errors, but we'll add those when we require them. Just add one as an example for now.
Use a
ExceptionMapper<FiazardException>
for this purpose and register this as a Provider to your dropwizard environment.