Created
October 15, 2011 11:03
-
-
Save vyazelenko/1289406 to your computer and use it in GitHub Desktop.
Test file to reproduce IllegalStateException on TemporaryFolder.newFile(String)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import static org.hamcrest.CoreMatchers.*; | |
import java.io.File; | |
import java.io.IOException; | |
import org.junit.Test; | |
import org.junit.rules.TemporaryFolder; | |
public class TemporaryFolderTest { | |
@Test | |
public void canCreateTemporaryFileWithGivenName() throws IOException { | |
TemporaryFolder tempFolder = new TemporaryFolder(); | |
File file = tempFolder.newFile("MyFile.txt"); | |
assertThat("File", file, is(notNullValue())); | |
assertThat("File doesn't exist", file.exists(), is(true)); | |
assertThat("File name", file.getName(), is("MyFile.txt")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment