BAEL-3227 fixed tests
This commit is contained in:
parent
ed459a5786
commit
ed7b67f19c
|
@ -4,6 +4,8 @@ import org.junit.Test;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class CreateFilesUnitTest {
|
||||
@Test(expected = IOException.class)
|
||||
public void whenCreatingAFileWithAbsolutePath_thenExceptionIsThrown() throws IOException {
|
||||
|
@ -12,18 +14,24 @@ public class CreateFilesUnitTest {
|
|||
Files.touch(fileWithAbsolutePath);
|
||||
}
|
||||
|
||||
@Test(expected = IOException.class)
|
||||
public void givenAnExistingDirectory_whenCreatingANewDirectoryAndFile_thenExceptionIsThrown() throws IOException {
|
||||
@Test
|
||||
public void givenAnExistingDirectory_whenCreatingANewDirectoryAndFile_thenFileIsCreated() throws IOException {
|
||||
File tempDirectory = new File(System.getProperty("java.io.tmpdir"));
|
||||
File fileWithRelativePath = new File(tempDirectory, "myDirectory/newFile.txt");
|
||||
|
||||
fileWithRelativePath.mkdirs();
|
||||
Files.touch(fileWithRelativePath);
|
||||
|
||||
assertTrue(fileWithRelativePath.exists());
|
||||
}
|
||||
|
||||
@Test(expected = IOException.class)
|
||||
public void whenCreatingAFileWithFileSeparator_thenPathIsCreated() throws IOException {
|
||||
@Test
|
||||
public void whenCreatingAFileWithFileSeparator_thenFileIsCreated() throws IOException {
|
||||
File newFile = new File("src" + File.separator + "test" + File.separator + "resources" + File.separator + "newFile.txt");
|
||||
|
||||
newFile.mkdirs();
|
||||
Files.touch(newFile);
|
||||
|
||||
assertTrue(newFile.exists());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue