O'Reilly logo

Testing with JUnit by Frank Appel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with advanced concepts

JUnit comes with a set of readymade rules, taking away some of the burden of common test-related development tasks, and we've already encountered a few of them. But the tool offers additional capabilities, allowing us to apply and combine rules in a way so as to meet special requirements, at which we'll have a look in the following section.

Using ClassRules

At times, integration tests need access to external resources, which can be expensive to establish. If these resources do not contribute more to the precondition of any test, rather than being an environmental invariant, testing individual creations and disposing of them might be a waste.

Think of an application server necessary as the infrastructure to provide the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required