Quantcast
Viewing latest article 1
Browse Latest Browse All 9

Hidden JUnit features: @Rules

@Rules seem a better solution than @RunWith to do some special work before/after a test. The release notes mention a couple of ideas:

  • Notification on tests
  • Setting up or tearing down resources, especially when they are used in multiple test classes
  • Special checks performed after every test, possibly causing a test to fail.
  • Making information about the test available inside the test

Related articles:


Tagged: Development Tools, Java, JUnit, Programming, Tests, Unit testing Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 1
Browse Latest Browse All 9

Trending Articles