Skip to content

Commit

Permalink
remove unnecessary I/O indirections (#119)
Browse files Browse the repository at this point in the history
* remove unnecessary code
* remove unneeded override
  • Loading branch information
elharo authored May 21, 2023
1 parent f3e9603 commit 472ed5a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class AbstractCheckstyleTestCase extends AbstractMojoTestCase {
private ArtifactStubFactory artifactStubFactory;

/**
* The current project to be test.
* The project to test.
*/
private MavenProject testMavenProject;

Expand Down Expand Up @@ -80,9 +80,9 @@ protected MavenProject getTestMavenProject() {
/**
* Get the generated report as file in the test maven project.
*
* @param name the name of the report.
* @param name the name of the report
* @return the generated report as file
* @throws IOException if the return file doesnt exist
* @throws IOException if the return file doesn't exist
*/
protected File getGeneratedReport(String name) throws IOException {
String outputDirectory = getBasedir() + "/target/test/test-harness/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.apache.maven.model.Build;
import org.apache.maven.model.Organization;
import org.apache.maven.model.ReportPlugin;
import org.codehaus.plexus.PlexusTestCase;

/**
* @author Edwin Punzalan
Expand All @@ -42,27 +41,22 @@ public List<String> getCompileClasspathElements() throws DependencyResolutionReq
/** {@inheritDoc} */
public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
List<String> list = new ArrayList<>(getCompileClasspathElements());
list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
list.add("target/test-classes");
return list;
}

/** {@inheritDoc} */
public List<String> getCompileSourceRoots() {
return Collections.singletonList(PlexusTestCase.getBasedir() + "/target/classes");
return Collections.singletonList("target/classes");
}

/** {@inheritDoc} */
public List<String> getTestCompileSourceRoots() {
List<String> list = new ArrayList<>(getCompileSourceRoots());
list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
list.add("target/test-classes");
return list;
}

/** {@inheritDoc} */
public File getBasedir() {
return new File(PlexusTestCase.getBasedir());
}

/** {@inheritDoc} */
public List<ReportPlugin> getReportPlugins() {
ReportPlugin jxrPlugin = new ReportPlugin();
Expand Down Expand Up @@ -90,7 +84,7 @@ public String getInceptionYear() {
public Build getBuild() {
Build build = new Build();

build.setDirectory(PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/min");
build.setDirectory("target/test-harness/checkstyle/min");

return build;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.apache.maven.model.Build;
import org.apache.maven.model.Organization;
import org.apache.maven.model.ReportPlugin;
import org.codehaus.plexus.PlexusTestCase;

/**
* @author Edwin Punzalan
Expand All @@ -43,27 +42,22 @@ public List<String> getCompileClasspathElements() throws DependencyResolutionReq
/** {@inheritDoc} */
public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
List<String> list = new ArrayList<>(getCompileClasspathElements());
list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
list.add("target/test-classes");
return list;
}

/** {@inheritDoc} */
public List<String> getCompileSourceRoots() {
return Collections.singletonList(PlexusTestCase.getBasedir() + "/target/classes");
return Collections.singletonList("target/classes");
}

/** {@inheritDoc} */
public List<String> getTestCompileSourceRoots() {
List<String> list = new ArrayList<>(getCompileSourceRoots());
list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
list.add("target/test-classes");
return list;
}

/** {@inheritDoc} */
public File getBasedir() {
return new File(PlexusTestCase.getBasedir());
}

/** {@inheritDoc} */
public List<ReportPlugin> getReportPlugins() {
ReportPlugin jxrPlugin = new ReportPlugin();
Expand Down Expand Up @@ -91,9 +85,9 @@ public String getInceptionYear() {
public Build getBuild() {
Build build = new Build();

build.setDirectory(PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/multi");
build.setSourceDirectory(PlexusTestCase.getBasedir() + "/src/test/test-sources");
build.setTestSourceDirectory(PlexusTestCase.getBasedir() + "/src/test/java");
build.setDirectory("target/test-harness/checkstyle/multi");
build.setSourceDirectory("src/test/test-sources");
build.setTestSourceDirectory("src/test/java");

return build;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.apache.maven.model.Organization;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.PlexusTestCase;

/**
*
Expand Down Expand Up @@ -63,11 +62,6 @@ public List<String> getTestCompileSourceRoots() {
return Collections.emptyList();
}

/** {@inheritDoc} */
public File getBasedir() {
return new File(PlexusTestCase.getBasedir());
}

/** {@inheritDoc} */
public List<ReportPlugin> getReportPlugins() {
ReportPlugin jxrPlugin = new ReportPlugin();
Expand Down Expand Up @@ -95,7 +89,7 @@ public String getInceptionYear() {
public Build getBuild() {
Build build = new Build();

build.setDirectory(PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/multi");
build.setDirectory("target/test-harness/checkstyle/multi");

return build;
}
Expand Down

0 comments on commit 472ed5a

Please sign in to comment.