Testing with Spring
December 8th, 2009
To improve the quality of your code it is important to thoroughly test your code. Not only using unit tests but also using integration tests. I’ll describe these terms and show examples on how to create tests using JUnit and Spring’s Test library.
Unit Testing
A unit-test is an automated test that tests one single unit-of-work. So, what is this unit-of-work? Its the smallest piece of code that can be distinguished. If you are programming in Java the smallest unit you can test is a single method. So all unit-tests should only test this single unit, and no other dependencies.
Here is an example of a unit-test:
Category: Java Programming | Tags: context, integration, junit, mock, spring, tdd, test | Comment (0)