Some JUnit Rules
Categories: Java
Here are a couple of simple but useful JUnit rule classes I have developed:
- WorkdirRule - creates a temporary directory for each test, and cleans it up afterwards; and
- LogInterceptRule - for apps using SLF4J/Logback, this captures logging output for use in assertions
Update: some additional thoughts on testing exceptions with JUnit