public class RuleTest {
@Rule
public TemporaryFolder tmpFolder = new TemporaryFolder();
@Test
public void shouldCreateNewFileInTemporaryFolder() throws IOException {
File created = tmpFolder.newFile("file.txt");
assertTrue(created.isFile());
assertEquals(tmpFolder.getRoot(), created.getParentFile());
}
}