Package org.junit.rules

Examples of org.junit.rules.TemporaryFolder


        }
    }

    @Test
    public void recursiveDeleteFolderWithOneElement() throws IOException {
        TemporaryFolder folder = new TemporaryFolder();
        folder.create();
        File file = folder.newFile("a");
        folder.delete();
        assertFalse(file.exists());
        assertFalse(folder.getRoot().exists());
    }
View Full Code Here


        assertFalse(folder.getRoot().exists());
    }

    @Test
    public void recursiveDeleteFolderWithOneRandomElement() throws IOException {
        TemporaryFolder folder = new TemporaryFolder();
        folder.create();
        File file = folder.newFile();
        folder.delete();
        assertFalse(file.exists());
        assertFalse(folder.getRoot().exists());
    }
View Full Code Here

        assertFalse(folder.getRoot().exists());
    }

    @Test
    public void recursiveDeleteFolderWithZeroElements() throws IOException {
        TemporaryFolder folder = new TemporaryFolder();
        folder.create();
        folder.delete();
        assertFalse(folder.getRoot().exists());
    }
View Full Code Here

    @Rule
    public final ExpectedException thrown = ExpectedException.none();

    @Before
    public void setUp() {
        tempFolder = new TemporaryFolder();
    }
View Full Code Here

        tempFolder.delete();
    }

    @Test(expected = IllegalStateException.class)
    public void getRootShouldThrowIllegalStateExceptionIfCreateWasNotInvoked() {
        new TemporaryFolder().getRoot();
    }
View Full Code Here

    }

    @Test(expected = IllegalStateException.class)
    public void newFileThrowsIllegalStateExceptionIfCreateWasNotInvoked()
            throws IOException {
        new TemporaryFolder().newFile();
    }
View Full Code Here

    }

    @Test(expected = IllegalStateException.class)
    public void newFileWithGivenNameThrowsIllegalStateExceptionIfCreateWasNotInvoked()
            throws IOException {
        new TemporaryFolder().newFile("MyFile.txt");
    }
View Full Code Here

    }

    @Test(expected = IllegalStateException.class)
    public void newFolderThrowsIllegalStateExceptionIfCreateWasNotInvoked()
            throws IOException {
        new TemporaryFolder().newFolder();
    }
View Full Code Here

        new TemporaryFolder().newFolder();
    }

    @Test(expected = IllegalStateException.class)
    public void newFolderWithGivenPathThrowsIllegalStateExceptionIfCreateWasNotInvoked() throws IOException {
        new TemporaryFolder().newFolder("level1", "level2", "level3");
    }
View Full Code Here

    @Test
    public void canSetTheBaseFileForATemporaryFolder() throws IOException {
        File tempDir = createTemporaryFolder();

        TemporaryFolder folder = new TemporaryFolder(tempDir);
        folder.create();

        assertThat(tempDir, is(folder.getRoot().getParentFile()));
    }
View Full Code Here

TOP

Related Classes of org.junit.rules.TemporaryFolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.