OPI Blog
Learn from experts in their fields

Browsing Tags: unit testing

Unit Testing Camel Routes with Spock
Introduction Apache Camel’s variety of components and message routing logic capabilities makes testing a requirement to ensure your routes are performing as expected. Since Camel routes are built within a context, it usually follows that ...
Sep 18, 2013
The Benefits of Using assertThat over other Assert Methods in Unit Tests
Introduction When Junit 4 was released a number of things changed, most notably the use of the test annotation so that there is no longer a need to extend TestCase and name methods starting with ...
Creating a Hierarchical Test Data Builder using Generics
At my current client, we had a situation where we needed to write JUnit tests for REST services which used a complex object hierarchy. Creating these objects manually proved to be very tedious, so having ...
Unit Testing Controllers in Grails 1.3.7
One benefit of Grails is its robust and versatile controller logic.  It can render responses in a multitude of formats, validate input, and handle a lot of processing behind the scenes.  This is all great and ...
How to Mock Final Classes in Unit Tests
Mocking has become a key component to writing effective unit-tests. It is a very useful strategy to write focused tests. Mocking frameworks make it easy to write test, but they have their limitations. Both Mockito ...
Loading test BLOB data into HSQLDB with a Groovy Ant Task
At my current client we use an in-memory HSQLDB for unit testing. An in-memory DB provides us a mechanism to test DAO’s and services against a known dataset. Overall this has worked out very well ...
How To Write JUnit Tests
Recently I've been asked "how do you get started writing unit tests?" I had to give great thought to the question. A lot of us have been writing unit tests for a long time, most using JUnit or a similar suite, so to many of us it's kind of second nature. After pondering and chatting more, here's what I came up with....
May 12, 2009
Updated JavaScript Unit Testing Presentation
I gave another presentation today on JavaScript Unit testing tools. This time I’ve advocated the use of HtmlUnit and Screw.Unit in combination. Screw.Unit is a JavaScript testing framework that’s great for unit tests, and HtmlUnit ...