Interface DirectoryBuilder

All Known Subinterfaces:
ManagedDirectory

public interface DirectoryBuilder
Chainable builder for creating directories.
Since:
0.0.1
Author:
Ashley Scopes
  • Method Details

    • copyContentsFrom

      Copy the contents of the directory at the given path recursively into this directory.

      Symbolic links will not be followed.

      This uses the default file system. If you want to use a different FileSystem as your source, then use copyContentsFrom(Path) instead.

      Examples:

      
         // Letting JCT infer the correct path separators to use (recommended).
         directoryBuilder.copyContentsFrom(List.of("foo", "bar", "baz"));
      
         // Using POSIX platform-specific separators (may cause issues if your tests run on Windows)
         directoryBuilder.copyContentsFrom(List.of("foo/bar/baz"));
      
         // Using Windows platform-specific separators (may cause issues if your tests run on POSIX)
         directoryBuilder.copyContentsFrom(List.of("foo\\bar\\baz"));
       
      Parameters:
      fragments - parts of the path.
      Returns:
      the root managed directory for further configuration.
      Throws:
      IllegalArgumentException - if no path fragments are provided.
      NullPointerException - if any null path fragments are provided.
      Since:
      4.0.0
      See Also:
    • copyContentsFrom

      default ManagedDirectory copyContentsFrom(String... fragments)
      Copy the contents of the directory at the given path recursively into this directory.

      Symbolic links will not be followed.

      This uses the default file system. If you want to use a different FileSystem as your source, then use copyContentsFrom(Path) instead.

      Examples:

      
         // Letting JCT infer the correct path separators to use (recommended).
         directoryBuilder.copyContentsFrom("foo", "bar", "baz");
      
         // Using POSIX platform-specific separators (may cause issues if your tests run on Windows)
         directoryBuilder.copyContentsFrom("foo/bar/baz");
      
         // Using Windows platform-specific separators (may cause issues if your tests run on POSIX)
         directoryBuilder.copyContentsFrom("foo\\bar\\baz");
       
      Parameters:
      fragments - parts of the path.
      Returns:
      the root managed directory for further configuration.
      Throws:
      IllegalArgumentException - if no path fragments are provided.
      NullPointerException - if any null path fragments are provided.
      See Also:
    • copyContentsFrom

      Copy the contents of the directory at the given path recursively into this directory.

      Symbolic links will not be followed.

      
        directory.copyContentsFrom(new File("code/examples"));
       
      Parameters:
      dir - the directory to copy the contents from.
      Returns:
      the root managed directory for further configuration.
    • copyContentsFrom

      Copy the contents of the directory at the given path recursively into this directory.

      Symbolic links will not be followed.

      
         directory.copyContentsFrom(Path.of("code", "examples"));
       
      Parameters:
      rootDir - the directory to copy the contents from.
      Returns:
      the root managed directory for further configuration.
    • thatIsEmpty

      Create an empty directory.
      
         directory.thatIsEmpty();
       
      Returns:
      the root managed directory for further configuration.