Class PathTestHelper


  • public final class PathTestHelper
    extends Object
    Maps between builder test and application class directories.
    • Method Detail

      • getTestClassesLocation

        public static Path getTestClassesLocation​(Class<?> testClass)
        Resolves the directory or the JAR file containing the test class.
        Parameters:
        testClass - the test class
        Returns:
        directory or JAR containing the test class
      • getAppClassLocation

        public static Path getAppClassLocation​(Class<?> testClass)
        Resolves the directory or the JAR file containing the application being tested by the test class.
        Parameters:
        testClass - the test class
        Returns:
        directory or JAR containing the application being tested by the test class
      • getAppClassLocationForTestLocation

        public static Path getAppClassLocationForTestLocation​(String testClassLocation)
        Resolves the directory or the JAR file containing the application being tested by a test from the given location.
        Parameters:
        testClassLocation - the test class location
        Returns:
        directory or JAR containing the application being tested by a test from the given location
      • getResourcesForClassesDirOrNull

        public static Path getResourcesForClassesDirOrNull​(Path classesDir,
                                                           String name)
        Returns the resources directory that compliments the classes directory. This is relevant in for Gradle where classes and resources have different output locations. The method will return null if classesDir is not a directory.
        Parameters:
        classesDir - classes directory
        name - 'test' for test resources or 'main' for the main resources
        Returns:
        resources directory if found or null otherwise
      • isTestClass

        public static boolean isTestClass​(String className,
                                          ClassLoader classLoader,
                                          Path testLocation)