Skip to content

Commit

Permalink
STAMP-project#19 Fix selection of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nrainer committed Sep 3, 2018
1 parent 888fb35 commit e77cd45
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/eu/stamp_project/PmpContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,21 @@ public static Boolean oneFileExists(List<String> fileNameList)

// **********************************************************************
public static ArrayList<String> getClasses(MavenProject theProject)
{
return getClassesInternal(theProject.getBuild().getOutputDirectory());
}

public static ArrayList<String> getTestClasses(MavenProject theProject)
{
return getClassesInternal(theProject.getBuild().getTestOutputDirectory());
}

private static ArrayList<String> getClassesInternal(String buildOutputDirectory)
{
ArrayList<String> classList = new ArrayList<String>();
ArrayList<String> classFilterList = new ArrayList<String>();
String outputDirName = theProject.getBuild().getOutputDirectory();
String aFilter;
File outputDir = new File(outputDirName);
File outputDir = new File(buildOutputDirectory);

if (outputDir.exists())
{
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/pitest/maven/PmpMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ public void updateTargetClasses()
}
}
}

public void updateTargetTests() {
if (targetTests == null || targetTests.isEmpty()) {
targetTests = new ArrayList<>();
targetTests.addAll(PmpContext.getTestClasses(getProject()));
}
}

// **********************************************************************
// protected
Expand Down Expand Up @@ -219,6 +226,7 @@ protected RunDecision shouldRun()
PmpContext.getInstance().setCurrentProject(myPmpProject);

updateTargetClasses();
updateTargetTests();

if (getProject().getPackaging().equals("pom") &&
myPmpProject.hasTestCompileSourceRoots() &&
Expand Down

0 comments on commit e77cd45

Please sign in to comment.