/** * Get the {@link Path} reference to the maven <code>${basedir}/src/test/resources</code> * directory * * @return the directory {@link Path} to the maven <code>${basedir}/src/test/resources</code> * directory */ public static Path getTestResourcesPath() { if (testResourcesPath == null) { testResourcesPath = getBasePath().resolve("src/test/resources"); PathAssert.assertDirExists("Test Resources Dir", testResourcesPath); } return testResourcesPath; }
/** * Get the {@link Path} reference to the <code>/target</code> directory for this project. * * <p>This is roughly equivalent to the <code>${project.build.directory}</code> property. * * <p>Note: this implementation does not inspect the <code>pom.xml</code> for non-standard * locations of the <code>${project.build.directory}</code> property. (it always assumes <code> * /target</code>) * * @return the directory path to the <code>/target</code> directory. */ public static Path getTargetPath() { if (targetPath == null) { targetPath = getBasePath().resolve("target"); PathAssert.assertDirExists("Target Dir", targetPath); } return targetPath; }
/** * Get a path resource (File or Dir) from the maven <code>${basedir}/src/test/resource</code> * directory. * * @param name the name of the path to get (it must exist) * @return the path in maven <code>${basedir}/src/test/resource</code> */ public static Path getTestResourcePath(String name) { Path path = getTestResourcesPath().resolve(name); PathAssert.assertPathExists("Test Resource Path", path); return path; }
/** * Get a file from the maven <code>${basedir}/src/test/resource</code> directory. * * <p>Note: will throw assertion error if path does point to an existing file * * @param name the name of the path to get (it must exist as a file) * @return the file in maven <code>${basedir}/src/test/resource</code> */ public static Path getTestResourcePathFile(String name) { Path file = getTestResourcesPath().resolve(name); PathAssert.assertFileExists("Test Resource File", file); return file; }
/** * Get a file from the maven <code>${basedir}/src/test/resource</code> directory. * * <p>Note: will throw assertion error if path does point to an existing file * * @param name the name of the path to get (it must exist as a file) * @return the file in maven <code>${basedir}/src/test/resource</code> */ public static File getTestResourceFile(String name) { File file = new File(getTestResourcesDir(), OS.separators(name)); PathAssert.assertFileExists("Test Resource File", file); return file; }
/** * Get a dir from the maven <code>${basedir}/src/test/resource</code> directory. * * <p>Note: will throw assertion error if path does point to an existing directory * * @param name the name of the path to get (it must exist as a dir) * @return the dir in the maven <code>${basedir}/src/test/resource</code> path */ public static Path getTestResourcePathDir(String name) { Path dir = getTestResourcesPath().resolve(name); PathAssert.assertDirExists("Test Resource Dir", dir); return dir; }
/** * Get a {@link Path} reference to a required directory in the project module path, based on * relative path references from maven ${basedir}. * * <p>Note: will throw assertion error if path does point to an existing directory * * @param path the relative path to reference * @return the directory reference (must exist) */ public static Path getProjectDirPath(String path) { Path dir = getBasePath().resolve(path); PathAssert.assertDirExists("Project Dir", dir); return dir; }
/** * Get a {@link Path} reference to a required file in the project module path, based on relative * path references from maven ${basedir}. * * <p>Note: will throw assertion error if path does point to an existing file * * @param path the relative path to reference * @return the file reference (must exist) */ public static Path getProjectFilePath(String path) { Path file = getBasePath().resolve(path); PathAssert.assertFileExists("Project File", file); return file; }