Testing with files and directories in JUnit with @Rule
![Image](http://1.bp.blogspot.com/-QpQ0beDDQMg/UrNsSaLFjdI/AAAAAAAAG4g/670PHoRfCQg/s320/junit.gif)
Testing with Files and directories in JUnit is easy thanks to TemporaryFolder @Rule . In JUnit rules ( @Rule ) can be used as an alternative or an addition to fixture setup and cleanup methods ( org.junit.Before , org.junit.After , org.junit.BeforeClass , and org.junit.AfterClass ), but they are more powerful, and can be more easily shared between projects and classes.