Tag Archives: junit

Test System.out with JUnit

It can be useful to verify output to System.out in a unit test. For example, if you’re testing application logging or if you’re using log output to sense some other behaviour. It can be tricky to properly mock behaviour of System.out but fortunately, it is possible to test System.out using JUnit.

Test Coverage

Using code test coverage analysis we’ve got a new metric we can use to judge the quality of our code. As with any metric though, some discretion is required… I find that this sort of tool is mostly useful to catch dumb mistakes.

DbUnit

DbUnit is a JUnit extension targeted at database-driven projects that, among other things, puts your database into a known state between test runs.

JUnit testing Hibernate and Spring

A nice recipe for unit testing Spring configured Hibernate.