Package org.junit.rules

Examples of org.junit.rules.TemporaryFolder


    }

    public static class MethodTestWithProtectedClassRule {
        @ClassRule
        protected static TestRule getTemporaryFolder() {
            return new TemporaryFolder();
        }
View Full Code Here


    }

    public static class MethodTestWithNonStaticClassRule {
        @ClassRule
        public TestRule getTemporaryFolder() {
            return new TemporaryFolder();
        }
View Full Code Here

    public static class MethodTestWithStaticClassAndTestRule {
        @ClassRule
        @Rule
        public static TestRule getTemporaryFolder() {
            return new TemporaryFolder();
        }
View Full Code Here

    }

    public static class TestMethodWithNonStaticTestRule {
        @Rule
        public TestRule getTemporaryFolder() {
            return new TemporaryFolder();
        }
View Full Code Here

    }

    public static class TestMethodWithStaticTestRule {
        @Rule
        public static TestRule getTemporaryFolder() {
            return new TemporaryFolder();
        }
View Full Code Here

  private static final AtomicBoolean once = new AtomicBoolean(false);

  public static final boolean initOnce() throws IOException {
    if (once.compareAndSet(false, true)) {
      final TemporaryFolder tmpFolder = new TemporaryFolder();
      tmpFolder.create();
      init(tmpFolder.newFolder());

      // add shutdown hook because we want to initialized/cleanup once
      Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        @Override
        public void run() {
          try {
            finish();
          } finally {
            tmpFolder.delete();
          }
        }
      }));
      return true;
    }
View Full Code Here

    private File root;
    private File relativeNonExist;

    @Before
    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");
        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

                           "tag",
                           "text",
                           new XElement(XNamespace.namespace("http://example.com"), "child"));
        prefixed = new XElement(XNamespace.namespace("aa", "http://example.com"), "child");

        folder = new TemporaryFolder();
        folder.create();
    }
View Full Code Here

    private TemporaryFolder folder;

    @Before
    public void setUp() throws IOException {
        doc = new XDocument();
        folder = new TemporaryFolder();
        folder.create();
    }
View Full Code Here

        initMockMuleContext();
    }

    private void initTemporaryFolder() throws IOException
    {
        tempFolder = new TemporaryFolder();
        tempFolder.create();
    }
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.