Skip to content

Instantly share code, notes, and snippets.

@eyalgo
Created March 4, 2019 12:49
Show Gist options
  • Save eyalgo/7d6b414d5b20041020ef7ebc26adba73 to your computer and use it in GitHub Desktop.
Save eyalgo/7d6b414d5b20041020ef7ebc26adba73 to your computer and use it in GitHub Desktop.
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());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment