org.thewonderlemming.c4plantuml.testbed.mojo

## Class TestableAbstractParentMojo

- java.lang.Object
- - org.apache.maven.plugin.AbstractMojo
  - - org.thewonderlemming.c4plantuml.mojo.AbstractParentMojo
    - - org.thewonderlemming.c4plantuml.testbed.mojo.TestableAbstractParentMojo

- All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

      public class TestableAbstractParentMojo
      extends AbstractParentMojo

  A non-abstract instance of `AbstractParentMojo` for testing purposes.
  Author:
    thewonderlemming

- - ### Field Summary

    - ### Fields inherited from class org.thewonderlemming.c4plantuml.mojo.AbstractParentMojo

      `DEFAULT_SOURCE_FILE_EXTENSION`

    - ### Fields inherited from interface org.apache.maven.plugin.Mojo

      `ROLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestableAbstractParentMojo()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doExecute()` A test implementation of that method that verifies that the method is indeed called during the plugin execution.
    `Charset` | `getCurrentCharsetForTesting()` Exposes the `AbstractParentMojo.getCurrentCharset()` method.
    `List<Path>` | `getEveryFileFromProcessOutputDirectoryFiles()` An implementation of the `AbstractParentMojo.processOutputDirectoryFiles(java.util.function.Consumer)` to allow its testing, that excludes IT directories.
    `List<Path>` | `getEveryFileFromProcessOutputDirectoryFiles(boolean excludeItDirectories)` An implementation of the `AbstractParentMojo.processOutputDirectoryFiles(java.util.function.Consumer)` to allow its testing.
    `org.apache.maven.plugin.logging.Log` | `getLog()` Returns a SLF4J based instance of `Log`.
    `String` | `getSourceFileExtensionForTesting()` Exposes the `AbstractParentMojo.getSourceFileExtension()` method for testing purposes.
    `boolean` | `isDoExecuteCalled()` Checks whether or not the `AbstractParentMojo.doExecute()` is called during the MOJO execution.
    `void` | `validateSourceFileExtensionForTesting()` Exposes the `AbstractParentMojo.validateSourceFileExtension()` method for testing purposes.

    - ### Methods inherited from class org.thewonderlemming.c4plantuml.mojo.AbstractParentMojo

      `execute, getCurrentCharset, getOutputDirectory, getProject, getSourceFileExtension, processOutputDirectoryFiles, validateSourceFileExtension`

    - ### Methods inherited from class org.apache.maven.plugin.AbstractMojo

      `getPluginContext, setLog, setPluginContext`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TestableAbstractParentMojo

          public TestableAbstractParentMojo()

  - ### Method Detail

    - #### getCurrentCharsetForTesting

          public Charset getCurrentCharsetForTesting()

      Exposes the `AbstractParentMojo.getCurrentCharset()` method.
      Returns:
        the current `Charset`.

    - #### getEveryFileFromProcessOutputDirectoryFiles

          public List<Path> getEveryFileFromProcessOutputDirectoryFiles()
                                                                 throws IOException

      An implementation of the `AbstractParentMojo.processOutputDirectoryFiles(java.util.function.Consumer)` to allow its testing, that excludes IT directories.
      Returns:
        the list of processed/found paths.
      Throws:
        `IOException` - if any I/O error happened while trying to access a path.

    - #### getEveryFileFromProcessOutputDirectoryFiles

          public List<Path> getEveryFileFromProcessOutputDirectoryFiles(boolean excludeItDirectories)
                                                                 throws IOException

      An implementation of the `AbstractParentMojo.processOutputDirectoryFiles(java.util.function.Consumer)` to allow its testing.
      Parameters:
        `excludeItDirectories` - a flag to tell to exclude IT directories.
      Returns:
        the list of processed/found paths.
      Throws:
        `IOException` - if any I/O error happened while trying to access a path.

    - #### getLog

          public org.apache.maven.plugin.logging.Log getLog()

      Returns a SLF4J based instance of `Log`.

      Specified by:
        `getLog` in interface `org.apache.maven.plugin.Mojo`
      Overrides:
        `getLog` in class `org.apache.maven.plugin.AbstractMojo`

    - #### getSourceFileExtensionForTesting

          public String getSourceFileExtensionForTesting()

      Exposes the `AbstractParentMojo.getSourceFileExtension()` method for testing purposes.
      Returns:
        the current source file extension.

    - #### isDoExecuteCalled

          public boolean isDoExecuteCalled()

      Checks whether or not the `AbstractParentMojo.doExecute()` is called during the MOJO execution.
      Returns:
        `true` if the `AbstractParentMojo.doExecute()` is called during execution, `false` else.

    - #### validateSourceFileExtensionForTesting

          public void validateSourceFileExtensionForTesting()

      Exposes the `AbstractParentMojo.validateSourceFileExtension()` method for testing purposes.

    - #### doExecute

          protected void doExecute()
                            throws org.apache.maven.plugin.MojoExecutionException,
                                   org.apache.maven.plugin.MojoFailureException

      A test implementation of that method that verifies that the method is indeed called during the plugin execution.

      Specified by:
        `doExecute` in class `AbstractParentMojo`
      Throws:
        `org.apache.maven.plugin.MojoExecutionException`
        `org.apache.maven.plugin.MojoFailureException`

Copyright © 2020. All rights reserved.