Class Environment.Mock

java.lang.Object
com.qulice.spi.Environment.Mock
All Implemented Interfaces:
Environment
Enclosing interface:
Environment

public static final class Environment.Mock extends Object implements Environment
Mock of Environment.
Since:
0.1
  • Constructor Details

    • Mock

      public Mock()
      Default constructor.
  • Method Details

    • withTestdir

      public Environment.Mock withTestdir(String path)
      With this extra test source root, the way build-helper-maven-plugin would add one.
      Parameters:
      path - Directory name, related to basedir
      Returns:
      This object
    • withParam

      public Environment.Mock withParam(String name, String value)
      With this param and its value.
      Parameters:
      name - Param name
      value - Param value
      Returns:
      This object
    • withFile

      public Environment.Mock withFile(String name, String content) throws IOException
      With this file on board.
      Parameters:
      name - File name related to basedir
      content - File content to write
      Returns:
      This object
      Throws:
      IOException - If some IO problem
    • withFile

      public Environment.Mock withFile(String name, byte[] bytes) throws IOException
      With this file on board.
      Parameters:
      name - File name related to basedir
      bytes - File content to write
      Returns:
      This object
      Throws:
      IOException - If some IO problem
    • withExcludes

      public Environment.Mock withExcludes(String excludes)
      With exclude patterns.
      Parameters:
      excludes - Exclude patterns
      Returns:
      This object
    • withDefaultClasspath

      public Environment.Mock withDefaultClasspath()
      With default classpath.
      Returns:
      This object
    • basedir

      public File basedir()
      Description copied from interface: Environment
      Get project's basedir.
      Specified by:
      basedir in interface Environment
      Returns:
      The directory
    • tempdir

      public File tempdir()
      Description copied from interface: Environment
      Get directory to keep temporary files in.
      Specified by:
      tempdir in interface Environment
      Returns:
      The directory
    • outdir

      public File outdir()
      Description copied from interface: Environment
      Get directory where .class files are stored.
      Specified by:
      outdir in interface Environment
      Returns:
      The directory
    • testdirs

      public Collection<File> testdirs()
      Description copied from interface: Environment
      Get the directories the project keeps its test sources in.

      Maven allows a project to register any number of test source roots, either through <testSourceDirectory> or through a plugin such as build-helper-maven-plugin:add-test-source, which the jcabi parent POM uses for src/mock/java. A file therefore cannot be told from a main one by its path alone, and whoever needs to know has to ask for these roots.

      Specified by:
      testdirs in interface Environment
      Returns:
      Test source roots, absolute, possibly empty
    • param

      public String param(String name, String value)
      Description copied from interface: Environment
      Get parameter by name, and return default if it's not set.
      Specified by:
      param in interface Environment
      Parameters:
      name - The name of parameter
      value - Default value to return as default
      Returns:
      The value
    • classloader

      public ClassLoader classloader()
      Description copied from interface: Environment
      Get classloader for this project.
      Specified by:
      classloader in interface Environment
      Returns:
      The classloader
    • classpath

      public Collection<String> classpath()
      Description copied from interface: Environment
      Get list of paths in classpath.
      Specified by:
      classpath in interface Environment
      Returns:
      The collection of paths
    • files

      public Collection<File> files(String pattern)
      Description copied from interface: Environment
      Returns the files matching the specified pattern.

      The pattern matching scheme used is wildcard matching. The characters '?' and '*' represents single or multiple wildcard characters, respectively. Pattern matching is case sensitive.

      Specified by:
      files in interface Environment
      Parameters:
      pattern - File name pattern
      Returns:
      Collection of files, matching the specified pattern
    • exclude

      public boolean exclude(String check, String name)
      Description copied from interface: Environment
      Shall this item be excluded from report?
      Specified by:
      exclude in interface Environment
      Parameters:
      check - Name of the check that is asking
      name - File or any other item, which is subject of validation
      Returns:
      TRUE if it should be ignored
    • excludes

      public Collection<String> excludes(String checker)
      Description copied from interface: Environment
      List of exclude patterns for given checker. Each list element will contain exactly one exclude pattern which, depending on the plugin that uses the excludes might be either wildcard (CodeNarc) pattern or regex pattern (FindBugs).
      Specified by:
      excludes in interface Environment
      Parameters:
      checker - Name of the checker that is asking (pmd, codenarc ...)
      Returns:
      Exclude patterns
    • encoding

      public Charset encoding()
      Description copied from interface: Environment
      Encoding for the files.
      Specified by:
      encoding in interface Environment
      Returns:
      Source files charset