JUnit 5 with Spring Boot (plus Kotlin)
This summer the JUnit team released a beta version of the next iteration, version five. This newest version adds a ton of new features that will be a welcome relief for JVM developers who have ...
Automatically JUnit Test DTO and Transfer Objects
When testing Data Transfer Objects (DTOs) or Transfer Objects you can go a few different routes. If you’re a purist you would say that a unit test should only be written for code that matters. I agree ...
Testing GWT with GwtMockito
Introduction This article shows how to use Mockito’s doAnswer() and thenAnswer() to test hard to reach code usually written within a GWT application. The technique of calling anonymous inner classes from test code applies to ...
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 ...
REST Client Testing With MockRestServiceServer
Functionally testing a REST Client is simple with the new MockRestServiceServer if you are using Spring’s RestTemplate to power the client. This is a new feature in Spring 3.2.x but was available via the spring-test-mvc ...
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 ...
Dec 30, 2010
Ant,
BLOB,
BLOB DATA,
groovy,
groovy_ant,
groovy-ant,
HSQL,
HSQLDB,
Java,
JUnit,
Testing,
unit testing
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....