Class TestResources

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    @Deprecated
    public class TestResources
    extends org.junit.rules.TestWatcher
    Deprecated.
    As of version 3.4.0, it is advised to work with JUnit5 tests which do not use rules but extensions MojoExtension instead.
    Junit4 test Rule to extract and assert test resources.
    Since:
    3.1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      TestResources()
      Deprecated.
       
      TestResources​(java.lang.String projectsDir, java.lang.String workDir)
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void assertDirectoryContents​(java.io.File dir, java.lang.String... expectedPaths)
      Deprecated.
       
      static void assertFileContents​(java.io.File basedir, java.lang.String expectedPath, java.lang.String actualPath)
      Deprecated.
       
      static void cp​(java.io.File basedir, java.lang.String from, java.lang.String to)
      Deprecated.
       
      static void create​(java.io.File basedir, java.lang.String... paths)
      Deprecated.
       
      java.io.File getBasedir​(java.lang.String project)
      Deprecated.
      Creates new clean copy of test project directory structure.
      static void rm​(java.io.File basedir, java.lang.String path)
      Deprecated.
       
      protected void starting​(org.junit.runner.Description d)
      Deprecated.
       
      static void touch​(java.io.File file)
      Deprecated.
       
      static void touch​(java.io.File basedir, java.lang.String path)
      Deprecated.
       
      • Methods inherited from class org.junit.rules.TestWatcher

        apply, failed, finished, skipped, skipped, succeeded
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestResources

        public TestResources()
        Deprecated.
      • TestResources

        public TestResources​(java.lang.String projectsDir,
                             java.lang.String workDir)
        Deprecated.
    • Method Detail

      • starting

        protected void starting​(org.junit.runner.Description d)
        Deprecated.
        Overrides:
        starting in class org.junit.rules.TestWatcher
      • getBasedir

        public java.io.File getBasedir​(java.lang.String project)
                                throws java.io.IOException
        Deprecated.
        Creates new clean copy of test project directory structure. The copy is named after both the test being executed and test project name, which allows the same test project can be used by multiple tests and by different instances of the same parametrized tests.

        TODO Provide alternative working directory naming for Windows, which still limits path names to ~250 charecters

        Throws:
        java.io.IOException
      • cp

        public static void cp​(java.io.File basedir,
                              java.lang.String from,
                              java.lang.String to)
                       throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • assertFileContents

        public static void assertFileContents​(java.io.File basedir,
                                              java.lang.String expectedPath,
                                              java.lang.String actualPath)
                                       throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • assertDirectoryContents

        public static void assertDirectoryContents​(java.io.File dir,
                                                   java.lang.String... expectedPaths)
        Deprecated.
      • touch

        public static void touch​(java.io.File basedir,
                                 java.lang.String path)
                          throws java.lang.InterruptedException
        Deprecated.
        Throws:
        java.lang.InterruptedException
      • touch

        public static void touch​(java.io.File file)
                          throws java.lang.InterruptedException
        Deprecated.
        Throws:
        java.lang.InterruptedException
      • rm

        public static void rm​(java.io.File basedir,
                              java.lang.String path)
        Deprecated.
      • create

        public static void create​(java.io.File basedir,
                                  java.lang.String... paths)
                           throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
        Since:
        3.2.0