Using JUnit With Eclipse IDE (21 tags)
Test-driven development principles call for writing the tests before writing any code. Alexander and Olexiy Prohorenko demonstrate how this approach can be used with the JUnit testing tool and the Eclipse IDE.
Mock Objects in Unit Tests (18 tags)
Unit testing your code against a service or process that's either too expensive (commercial databases) or just not done yet is something you can deal with by simulating the other piece with a mock object. EasyMock can suffice in some cases, but it can only create mock objects for interfaces. Mocquer, based on the Dunamis project, can create mocks for classes, too. Lu Jian shows how it works.
Taking JUnit Out of the Box (4 tags)
JUnit is practically ubiquitous among Java developers as a way to test code, but it's somewhat limited by the fact that it's only meant to run in one JVM on one box, hampering its usefulness when developing distributed applications. In this article, Amir Shevat shows how the open source JUnit extension Pisces helps JUnit overcome this limitation.
Approaches to Mocking (2 tags)
Conceptually, you know what mock objects are, but practically speaking, how do you create and use them? Do you write mocks by hand or generate them automatically? Simon Stewart considers these possibilities and others, such as AOP-based mocking.
Effective Unit Testing with DbUnit (2 tags)
Writing unit tests first can be impractical when your code will depend on access to a database. Enter DbUnit, which allows you to write simple XML files to fill in for the yet-to-be populated database for testing purposes.