Package org.junit.rules

Examples of org.junit.rules.TemporaryFolder.newFile()


    @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


    @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

    public void createFiles() throws IOException {
        final TemporaryFolder temp = new TemporaryFolder();
        temp.create();
        root = temp.getRoot();

        temp.newFile("hoge.txt");
        temp.newFile("photo1.jpg");
        temp.newFile("photo2.jpg");

        final File sub = temp.newFolder("sub");
        final File file1 = temp.newFile("photo3.jpg");
View Full Code Here

        final TemporaryFolder temp = new TemporaryFolder();
        temp.create();
        root = temp.getRoot();

        temp.newFile("hoge.txt");
        temp.newFile("photo1.jpg");
        temp.newFile("photo2.jpg");

        final File sub = temp.newFolder("sub");
        final File file1 = temp.newFile("photo3.jpg");
        final File file2 = temp.newFile("photo4.jpg");
View Full Code Here

        temp.create();
        root = temp.getRoot();

        temp.newFile("hoge.txt");
        temp.newFile("photo1.jpg");
        temp.newFile("photo2.jpg");

        final File sub = temp.newFolder("sub");
        final File file1 = temp.newFile("photo3.jpg");
        final File file2 = temp.newFile("photo4.jpg");
        file1.renameTo(new File(sub.getAbsolutePath() + File.separator + file1.getName()));
View Full Code Here

        temp.newFile("hoge.txt");
        temp.newFile("photo1.jpg");
        temp.newFile("photo2.jpg");

        final File sub = temp.newFolder("sub");
        final File file1 = temp.newFile("photo3.jpg");
        final File file2 = temp.newFile("photo4.jpg");
        file1.renameTo(new File(sub.getAbsolutePath() + File.separator + file1.getName()));
        file2.renameTo(new File(sub.getAbsolutePath() + File.separator + file2.getName()));
        relativeNonExist = new File("./relative" + System.nanoTime() + ".txt");
    }
View Full Code Here

        temp.newFile("photo1.jpg");
        temp.newFile("photo2.jpg");

        final File sub = temp.newFolder("sub");
        final File file1 = temp.newFile("photo3.jpg");
        final File file2 = temp.newFile("photo4.jpg");
        file1.renameTo(new File(sub.getAbsolutePath() + File.separator + file1.getName()));
        file2.renameTo(new File(sub.getAbsolutePath() + File.separator + file2.getName()));
        relativeNonExist = new File("./relative" + System.nanoTime() + ".txt");
    }
View Full Code Here

    @Before
    public void createDirectory() throws IOException {
        final TemporaryFolder tempDir = createDir();
        final String[] dummyFiles = array("kafuka", "kaere", "kiri");
        for (final String name : dummyFiles) {
            tempDir.newFile(name);
        }
        dir = tempDir.getRoot();
        assertThat(dir.listFiles().length, is(dummyFiles.length));
    }
View Full Code Here

    // Make a new copy in a temporary file system so we don't overwrite our fixture
    String profilePath;

    try {
      Files.copy(resources.locate("profile/opera.ini"), temporaryProfile.newFile("operaprefs.ini"));
    } catch (IOException e) {
      fail("Unable to copy preference fixture: " + e.getMessage());
    }

    profilePath = temporaryProfile.getRoot().getAbsolutePath();
View Full Code Here

  @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

TOP
Copyright © 2018 www.massapi.com. 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.