Skip to content

Commit

Permalink
Fixed mojohaus#676: Removing BaseMojoTestCase -- not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejj0 committed Sep 10, 2022
1 parent ff7f209 commit 2088e18
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 150 deletions.
14 changes: 11 additions & 3 deletions src/test/java/org/codehaus/mojo/versions/SetMojoTest.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package org.codehaus.mojo.versions;

import java.io.File;

import org.apache.maven.model.Model;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.MojoRule;
import org.apache.maven.project.MavenProject;
import org.codehaus.mojo.versions.utils.BaseMojoTestCase;
import org.junit.Rule;
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

public class SetMojoTest extends BaseMojoTestCase
public class SetMojoTest extends AbstractMojoTestCase
{
@Rule
MojoRule mojoRule = new MojoRule( this );

@Test
public void testGetIncrementedVersion() throws MojoExecutionException
{
Expand Down Expand Up @@ -95,7 +102,8 @@ public void testNextSnapshotIndexWithoutNextSnapshot() throws MojoFailureExcepti
@Test
public void testVersionlessDependency() throws Exception
{
SetMojo myMojo = createMojo( "set", "src/test/resources/org/codehaus/mojo/set/versionless-01/pom.xml" );
SetMojo myMojo = (SetMojo) mojoRule.lookupConfiguredMojo(
new File( "target/test-classes/org/codehaus/mojo/set/versionless-01" ), "set" );
myMojo.execute();
}
}
21 changes: 15 additions & 6 deletions src/test/java/org/codehaus/mojo/versions/SetPropertyMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
* under the License.
*/

import java.io.File;

import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.mojo.versions.utils.BaseMojoTestCase;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.MojoRule;
import org.junit.Rule;
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
Expand All @@ -32,14 +36,18 @@
*
* @author Andrzej Jarmoniuk
*/
public class SetPropertyMojoTest extends BaseMojoTestCase
public class SetPropertyMojoTest extends AbstractMojoTestCase
{
@Rule
MojoRule mojoRule = new MojoRule( this );

@Test
public void testNullNewVersion()
throws Exception
{
SetPropertyMojo mojo = createMojo( "set-property",
"src/test/resources/org/codehaus/mojo/set-property/null-new-version-pom.xml" );
SetPropertyMojo mojo = (SetPropertyMojo) mojoRule.lookupConfiguredMojo(
new File( "target/test-classes/org/codehaus/mojo/set-property/null-new-version" ),
"set-property" );
assertThat( mojo.getProject().getProperties(), is( mojo.getProject().getModel().getProperties() ) );
try
{
Expand All @@ -57,8 +65,9 @@ public void testNullNewVersion()
public void testNullProperty()
throws Exception
{
SetPropertyMojo mojo = createMojo( "set-property",
"src/test/resources/org/codehaus/mojo/set-property/null-property-pom.xml" );
SetPropertyMojo mojo = (SetPropertyMojo) mojoRule.lookupConfiguredMojo(
new File( "target/test-classes/org/codehaus/mojo/set-property/null-property" ),
"set-property" );
try
{
mojo.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,30 @@
* under the License.
*/

import java.io.File;
import java.util.Collections;

import org.codehaus.mojo.versions.utils.BaseMojoTestCase;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.MojoRule;
import org.junit.Rule;
import org.junit.Test;

/**
* Basic tests for {@linkplain UseDepVersionMojo}.
*
* @author Andrzej Jarmoniuk
*/
public class UseDepVersionMojoTest extends BaseMojoTestCase
public class UseDepVersionMojoTest extends AbstractMojoTestCase
{
@Rule
MojoRule mojoRule = new MojoRule( this );

@Test
public void testIssue673() throws Exception
{
UseDepVersionMojo mojo = createMojo( "use-dep-version",
"src/test/resources/org/codehaus/mojo/use-dep-version/issue-637-pom.xml" );
UseDepVersionMojo mojo = (UseDepVersionMojo) mojoRule.lookupConfiguredMojo(
new File( "target/test-classes/org/codehaus/mojo/use-dep-version/issue-637" ),
"use-dep-version" );
setVariableValueToObject( mojo, "processDependencies", true );
setVariableValueToObject( mojo, "processDependencyManagement", true );
setVariableValueToObject( mojo, "excludeReactor", true );
Expand Down
136 changes: 0 additions & 136 deletions src/test/java/org/codehaus/mojo/versions/utils/BaseMojoTestCase.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<property>dummy-api-version</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<newVersion>2.0.0</newVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<goals>
<goal>set</goal>
</goals>
<configuration>
<updateBuildOutputTimestampPolicy>onchange</updateBuildOutputTimestampPolicy>
<artifactId>dummy-api</artifactId>
<newVersion>2.0</newVersion>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<depVersion>DEVELOP-SNAPSHOT</depVersion>
Expand Down

0 comments on commit 2088e18

Please sign in to comment.