Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Commit

Permalink
Refactor BetterAbstractMojoTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
skiddykong committed Feb 14, 2017
1 parent 9fa6c6b commit f3ef9ac
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 19 deletions.
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.justice</groupId>
<artifactId>maven-parent-pom</artifactId>
<version>1.2.0</version>
<version>1.4.0</version>
</parent>

<groupId>uk.gov.justice.maven</groupId>
Expand All @@ -22,14 +22,15 @@
<module>raml-maven-plugin-it</module>
<module>raml-generator-for-testing</module>
<module>lint-checker-core</module>
<module>raml-maven-test-utils</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>uk.gov.justice</groupId>
<artifactId>maven-common-bom</artifactId>
<version>1.5.0</version>
<version>1.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
3 changes: 1 addition & 2 deletions raml-maven-plugin-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand Down Expand Up @@ -94,7 +93,7 @@
<dependency>
<groupId>uk.gov.justice</groupId>
<artifactId>maven-common-bom</artifactId>
<version>1.5.0</version>
<version>1.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
16 changes: 6 additions & 10 deletions raml-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down Expand Up @@ -77,13 +76,11 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>3.3.9</version>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.3.9</version>
</dependency>

<dependency>
Expand All @@ -99,7 +96,6 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-aether-provider</artifactId>
<version>3.3.9</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -139,12 +135,6 @@
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
Expand All @@ -162,5 +152,11 @@
<artifactId>lint-checker-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>uk.gov.justice.maven</groupId>
<artifactId>raml-maven-test-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.util.List;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static org.hamcrest.core.IsEqual.equalTo;

import uk.gov.justice.raml.core.GeneratorConfig;
import uk.gov.justice.raml.maven.test.utils.BetterAbstractMojoTestCase;

import java.io.File;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import uk.gov.justice.raml.maven.generator.BetterAbstractMojoTestCase;
import uk.gov.justice.raml.maven.lintchecker.rules.FailingLintCheckRule;
import uk.gov.justice.raml.maven.lintchecker.rules.SucceedingLintCheckRule;
import uk.gov.justice.raml.maven.test.utils.BetterAbstractMojoTestCase;

import java.io.File;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import static org.mockito.Mockito.when;

import uk.gov.justice.raml.maven.common.BasicGoalConfig;
import uk.gov.justice.raml.maven.generator.BetterAbstractMojoTestCase;
import uk.gov.justice.raml.maven.test.utils.BetterAbstractMojoTestCase;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
</plugin>
</plugins>
</build>

</project>
49 changes: 49 additions & 0 deletions raml-maven-test-utils/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>raml-maven</artifactId>
<groupId>uk.gov.justice.maven</groupId>
<version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>raml-maven-test-utils</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<exclusions>
<exclusion>
<artifactId>plexus-container-default</artifactId>
<groupId>org.codehaus.plexus</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.raml.maven.generator;
package uk.gov.justice.raml.maven.test.utils;

import java.io.File;
import java.util.Arrays;
Expand Down Expand Up @@ -30,6 +30,15 @@
* methods. <p> This also provides new methods, {@link #newMavenSession()} to conveniently create a
* maven session, and {@link #lookupConfiguredMojo(File, String)} so you don't have to always build
* the project yourself.
*
* TODO: Determine how to unit test this class
* The only real way to test this class is to extend and create a concrete version
* and then build a MOJO to test, however this cannot be done without pulling in
* the extra dependencies into the project as MAIN. We are already doing this effectively
* in the raml-maven module and in the lint checker rules (in microservices framework).
* Originally this class was part of TEST in raml-maven-plugin and was moved into MAIN
* so it could be used across maven projects to test MOJOs.
*
*/
public abstract class BetterAbstractMojoTestCase extends AbstractMojoTestCase {

Expand Down

0 comments on commit f3ef9ac

Please sign in to comment.