DropWizard is a really cool framework / library that allows you to quickly build production-ready HTTP+JSON REST services. It is built on mature libraries like Jetty, Jersey, Jackson and Metrics.
The framework bring together a lot of neat ideas for API monitoring like Health checks and simple application metrics via Metrics. DropWizard is very performant, claiming to be able to handle 15,000-20,000 requests per second. There is a pretty good video hailing the benefits of DropWizard here. The MongoDB-DropWizard slideshow is also very good to see what is possible with the framework.
Compared to Grails, DropWizard feels slightly more lightweight and perfect for services that don’t really have much of a front-end. DropWizard and JavaScript fat clients is the new black.
In this post, I will share how you can use Spock and Groovy instead of the Java / JUnit / Mockito examples provided by the DropWizard User Manual.
If you are not familiar with DropWizard or the testing of DropWizard applications, I suggest reading their Quick Start Guide and User Manual. I will use the Representations and Resources in the Testing DropWizard chapter of their user guide as the basis for this post.
Continue reading →