JUnit testing Hibernate and Spring
Here’s a nice recipe for unit testing Spring configured Hibernate. It allows me to neatly test my Spring configured DAOs and reuse a lot of the Hibernate Session and Transaction configuration beans...
View ArticleDbUnit
I’ve decided to revisit the JUnit testing Hibernate and Spring recipe that I posted a while back. A problem with the previous recipe is that it did not provide any means to initialize the test...
View ArticleTest Coverage
I’ve been looking a lot recently at JUnit (and TestNG) tests on a code base I’m not too familiar with. In many cases I was not convinced that the tests were adequate but it took a fair bit of...
View ArticleTest System.out with JUnit
Edit: see also the follow up article on how to Test log4j with JUnit if you’re interested in specifically testing log output. Just occasionally, it can be useful to verify output to System.out in a...
View ArticleTest log4j with JUnit using a custom appender
Following a recent article on how to Test System.out with JUnit, here’s a follow up on how to test log4J with JUnit. This article describes a technique to test log4J output in a JUnit test by adding a...
View ArticleTest log4j2 with JUnit using a custom appender
In previous articles, I’ve described how to test System.out with JUnit and how to test log4j with JUnit. This article describes how to test log4j2 logging with JUnit. This largely follows the same...
View ArticleUnit test time based logic
A standard unit testing problem is how to unit test code that has a dependency on dates or times. For example a method that returns a greeting according to the time of day:public String...
View Article
More Pages to Explore .....