Cleaned up API to match bld operations and options APIs

This commit is contained in:
Erik C. Thauvin 2024-08-27 12:55:48 -07:00
parent e63c1a636e
commit 2b6b4a5e82
Signed by: erik
GPG key ID: 776702A6A2DA330E
3 changed files with 180 additions and 52 deletions

View file

@ -31,7 +31,7 @@ public class PmdOperationBuild extends Project {
public PmdOperationBuild() { public PmdOperationBuild() {
pkg = "rife.bld.extension"; pkg = "rife.bld.extension";
name = "bld-pmd"; name = "bld-pmd";
version = version(1, 1, 4); version = version(1, 1, 5, "SNAPSHOT");
javaRelease = 17; javaRelease = 17;
@ -44,11 +44,10 @@ public class PmdOperationBuild extends Project {
.include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1))) .include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1)))
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd)); .include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
scope(runtime) scope(runtime)
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd)) .include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 16)));
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 13)));
scope(test) scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)))
.include(dependency("org.assertj", "assertj-core", version(3, 26, 3))); .include(dependency("org.assertj", "assertj-core", version(3, 26, 3)));
javadocOperation() javadocOperation()

View file

@ -142,8 +142,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @see #inputPaths(Path...) * @see #inputPaths(Path...)
*/ */
public PmdOperation addInputPaths(Path... inputPath) { public PmdOperation addInputPaths(Path... inputPath) {
inputPaths_.addAll(List.of(inputPath)); return inputPaths(List.of(inputPath));
return this;
} }
/** /**
@ -154,8 +153,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @see #inputPaths(File...) * @see #inputPaths(File...)
*/ */
public PmdOperation addInputPaths(File... inputPath) { public PmdOperation addInputPaths(File... inputPath) {
inputPaths_.addAll(Arrays.stream(inputPath).map(File::toPath).toList()); return addInputPathsFiles(List.of(inputPath));
return this;
} }
/** /**
@ -163,11 +161,10 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param inputPath one or more paths * @param inputPath one or more paths
* @return this operation * @return this operation
* @see #addInputPaths(String...) * @see #inputPaths(String...)
*/ */
public PmdOperation addInputPaths(String... inputPath) { public PmdOperation addInputPaths(String... inputPath) {
inputPaths_.addAll(Arrays.stream(inputPath).map(Paths::get).toList()); return addInputPathsStrings(List.of(inputPath));
return this;
} }
/** /**
@ -182,6 +179,28 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this; return this;
} }
/**
* Adds paths to source files, or directories containing source files to analyze.
*
* @param inputPath a collection of input paths
* @return this operation
* @see #inputPathsFiles(Collection)
*/
public PmdOperation addInputPathsFiles(Collection<File> inputPath) {
return addInputPaths(inputPath.stream().map(File::toPath).toList());
}
/**
* Adds paths to source files, or directories containing source files to analyze.
*
* @param inputPath a collection of input paths
* @return this operation
* @see #inputPathsStrings(Collection)
*/
public PmdOperation addInputPathsStrings(Collection<String> inputPath) {
return addInputPaths(inputPath.stream().map(Paths::get).toList());
}
/** /**
* Adds new rule set paths. * Adds new rule set paths.
* <p> * <p>
@ -203,8 +222,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @see #ruleSets(String...) * @see #ruleSets(String...)
*/ */
public PmdOperation addRuleSet(String... ruleSet) { public PmdOperation addRuleSet(String... ruleSet) {
ruleSets_.addAll(List.of(ruleSet)); return addRuleSet(List.of(ruleSet));
return this;
} }
/** /**
@ -225,7 +243,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param ruleSet a collection of rule set paths * @param ruleSet a collection of rule set paths
* @return this operation * @return this operation
* @see #ruleSets(Collection * @see #ruleSets(Collection)
*/ */
public PmdOperation addRuleSet(Collection<String> ruleSet) { public PmdOperation addRuleSet(Collection<String> ruleSet) {
ruleSets_.addAll(ruleSet); ruleSets_.addAll(ruleSet);
@ -240,6 +258,21 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this; return this;
} }
/**
* Sets the location of the cache file for incremental analysis.
*/
public PmdOperation cache(File cache) {
return cache(cache.toPath());
}
/**
* Sets the location of the cache file for incremental analysis.
*/
public PmdOperation cache(String cache) {
return cache(Path.of(cache));
}
/** /**
* Sets the default language version to be used for all input files. * Sets the default language version to be used for all input files.
* *
@ -247,8 +280,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @return this operation * @return this operation
*/ */
public PmdOperation defaultLanguageVersions(LanguageVersion... languageVersion) { public PmdOperation defaultLanguageVersions(LanguageVersion... languageVersion) {
languageVersions_.addAll(List.of(languageVersion)); return languageVersions(List.of(languageVersion));
return this;
} }
/** /**
@ -268,8 +300,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* <p>The valid values are the standard character sets of {@link java.nio.charset.Charset Charset}.</p> * <p>The valid values are the standard character sets of {@link java.nio.charset.Charset Charset}.</p>
*/ */
public PmdOperation encoding(String encoding) { public PmdOperation encoding(String encoding) {
encoding_ = Charset.forName(encoding); return encoding(Charset.forName(encoding));
return this;
} }
/** /**
@ -385,8 +416,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @return this operation * @return this operation
*/ */
public PmdOperation ignoreFile(File ignoreFile) { public PmdOperation ignoreFile(File ignoreFile) {
ignoreFile_ = ignoreFile.toPath(); return ignoreFile(ignoreFile.toPath());
return this;
} }
/** /**
@ -396,8 +426,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @return this operation * @return this operation
*/ */
public PmdOperation ignoreFile(String ignoreFile) { public PmdOperation ignoreFile(String ignoreFile) {
ignoreFile_ = Paths.get(ignoreFile); return ignoreFile(Path.of(ignoreFile));
return this;
} }
/** /**
@ -495,9 +524,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @see #addInputPaths(Path...) * @see #addInputPaths(Path...)
*/ */
public PmdOperation inputPaths(Path... inputPath) { public PmdOperation inputPaths(Path... inputPath) {
inputPaths_.clear(); return inputPaths(List.of(inputPath));
inputPaths_.addAll(List.of(inputPath));
return this;
} }
/** /**
@ -510,9 +537,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @see #addInputPaths(File...) * @see #addInputPaths(File...)
*/ */
public PmdOperation inputPaths(File... inputPath) { public PmdOperation inputPaths(File... inputPath) {
inputPaths_.clear(); return inputPathsFiles(List.of(inputPath));
inputPaths_.addAll(Arrays.stream(inputPath).map(File::toPath).toList());
return this;
} }
/** /**
@ -525,9 +550,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @see #addInputPaths(String...) * @see #addInputPaths(String...)
*/ */
public PmdOperation inputPaths(String... inputPath) { public PmdOperation inputPaths(String... inputPath) {
inputPaths_.clear(); return inputPathsStrings(List.of(inputPath));
inputPaths_.addAll(Arrays.stream(inputPath).map(Paths::get).toList());
return this;
} }
/** /**
@ -537,7 +560,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param inputPath a collection of input paths * @param inputPath a collection of input paths
* @return this operation * @return this operation
* @see #addInputPaths(Collection) * @see #addInputPaths(Path...)
*/ */
public PmdOperation inputPaths(Collection<Path> inputPath) { public PmdOperation inputPaths(Collection<Path> inputPath) {
inputPaths_.clear(); inputPaths_.clear();
@ -554,6 +577,32 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return inputPaths_; return inputPaths_;
} }
/**
* Sets paths to source files, or directories containing source files to analyze.
* <p>
* Previous entries are disregarded.
*
* @param inputPath a collection of input paths
* @return this operation
* @see #addInputPaths(File...)
*/
public PmdOperation inputPathsFiles(Collection<File> inputPath) {
return inputPaths(inputPath.stream().map(File::toPath).toList());
}
/**
* Sets paths to source files, or directories containing source files to analyze.
* <p>
* Previous entries are disregarded.
*
* @param inputPath a collection of input paths
* @return this operation
* @see #addInputPaths(String...)
*/
public PmdOperation inputPathsStrings(Collection<String> inputPath) {
return inputPaths(inputPath.stream().map(Paths::get).toList());
}
/** /**
* Sets the default language versions. * Sets the default language versions.
* *
@ -561,8 +610,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @return this operation * @return this operation
*/ */
public PmdOperation languageVersions(LanguageVersion... languageVersion) { public PmdOperation languageVersions(LanguageVersion... languageVersion) {
languageVersions_.addAll(List.of(languageVersion)); return languageVersions(List.of(languageVersion));
return this;
} }
/** /**
@ -667,10 +715,10 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param relativeRoot one or more relative root paths * @param relativeRoot one or more relative root paths
* @return this operations * @return this operations
* @see #relativizeRoots(Collection)
*/ */
public PmdOperation relativizeRoots(Path... relativeRoot) { public PmdOperation relativizeRoots(Path... relativeRoot) {
relativizeRoots_.addAll(List.of(relativeRoot)); return relativizeRoots(List.of(relativeRoot));
return this;
} }
/** /**
@ -678,10 +726,10 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param relativeRoot one or more relative root paths * @param relativeRoot one or more relative root paths
* @return this operations * @return this operations
* @see #relativizeRootsFiles(Collection)
*/ */
public PmdOperation relativizeRoots(File... relativeRoot) { public PmdOperation relativizeRoots(File... relativeRoot) {
relativizeRoots_.addAll(Arrays.stream(relativeRoot).map(File::toPath).toList()); return relativizeRootsFiles(List.of(relativeRoot));
return this;
} }
/** /**
@ -689,10 +737,10 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param relativeRoot one or more relative root paths * @param relativeRoot one or more relative root paths
* @return this operations * @return this operations
* @see #relativizeRootsStrings(Collection)
*/ */
public PmdOperation relativizeRoots(String... relativeRoot) { public PmdOperation relativizeRoots(String... relativeRoot) {
relativizeRoots_.addAll(Arrays.stream(relativeRoot).map(Paths::get).toList()); return relativizeRootsStrings(List.of(relativeRoot));
return this;
} }
/** /**
@ -700,6 +748,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param relativeRoot a collection of relative root paths * @param relativeRoot a collection of relative root paths
* @return this operations * @return this operations
* @see #relativizeRoots(Path...)
*/ */
public PmdOperation relativizeRoots(Collection<Path> relativeRoot) { public PmdOperation relativizeRoots(Collection<Path> relativeRoot) {
relativizeRoots_.addAll(relativeRoot); relativizeRoots_.addAll(relativeRoot);
@ -715,6 +764,28 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return relativizeRoots_; return relativizeRoots_;
} }
/**
* Adds several paths to shorten paths that are output in the report.
*
* @param relativeRoot a collection of relative root paths
* @return this operations
* @see #relativizeRoots(File...)
*/
public PmdOperation relativizeRootsFiles(Collection<File> relativeRoot) {
return relativizeRoots(relativeRoot.stream().map(File::toPath).toList());
}
/**
* Adds several paths to shorten paths that are output in the report.
*
* @param relativeRoot a collection of relative root paths
* @return this operations
* @see #relativizeRoots(String...)
*/
public PmdOperation relativizeRootsStrings(Collection<String> relativeRoot) {
return relativizeRoots(relativeRoot.stream().map(Paths::get).toList());
}
/** /**
* Sets the path to the report page. * Sets the path to the report page.
* *

View file

@ -61,13 +61,13 @@ class PmdOperationTest {
PmdOperation newPmdOperation() { PmdOperation newPmdOperation() {
return new PmdOperation() return new PmdOperation()
.inputPaths(Path.of("src/main"), Path.of("src/test")) .inputPaths(Path.of("src/main"), Path.of("src/test"))
.cache(Paths.get("build", COMMAND_NAME, "pmd-cache")) .cache("build/" + COMMAND_NAME + "/pmd-cache")
.failOnViolation(false) .failOnViolation(false)
.reportFile(Paths.get("build", COMMAND_NAME, "pmd-test-report.txt")); .reportFile(Paths.get("build", COMMAND_NAME, "pmd-test-report.txt"));
} }
@Test @Test
void testAddInputPath() throws ExitStatusException { void testAddInputPaths() throws ExitStatusException {
var project = new BaseProject(); var project = new BaseProject();
var pmd = new PmdOperation().fromProject(project); var pmd = new PmdOperation().fromProject(project);
@ -82,17 +82,35 @@ class PmdOperationTest {
assertThat(pmd.inputPaths()).as("main").containsExactly(project.srcMainDirectory().toPath()); assertThat(pmd.inputPaths()).as("main").containsExactly(project.srcMainDirectory().toPath());
pmd.inputPaths().clear(); pmd.inputPaths().clear();
pmd.addInputPaths(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); pmd = pmd.addInputPaths(project.srcMainDirectory(), project.srcTestDirectory());
assertThat(pmd.inputPaths()).as("toPath(main, test)").containsExactly(project.srcMainDirectory().toPath(), assertThat(pmd.inputPaths()).as("main, test").containsExactly(project.srcMainDirectory().toPath(),
project.srcTestDirectory().toPath()); project.srcTestDirectory().toPath());
pmd.inputPaths().clear(); pmd.inputPaths().clear();
pmd.addInputPaths(List.of(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath())); pmd = pmd.addInputPathsFiles(List.of(project.srcMainDirectory(), project.srcTestDirectory()));
assertThat(pmd.inputPaths()).as("List(main, test)").containsExactly( assertThat(pmd.inputPaths()).as("PathsFiles(main, test)")
project.srcMainDirectory().toPath(), .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
project.srcTestDirectory().toPath());
pmd.inputPaths().clear();
pmd = pmd.addInputPathsStrings(
List.of(project.srcMainDirectory().getAbsolutePath(), project.srcTestDirectory().getAbsolutePath()));
assertThat(pmd.inputPaths()).as("PathsStrings(main, test)")
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
pmd.inputPaths().clear();
pmd = pmd.addInputPaths(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
assertThat(pmd.inputPaths()).as("toPath(main, test)")
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
pmd.inputPaths().clear();
pmd = pmd.addInputPaths(List.of(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()));
assertThat(pmd.inputPaths()).as("List(main, test)")
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))) assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
.isGreaterThan(0).isEqualTo(err); .isGreaterThan(0).isEqualTo(err);
@ -124,7 +142,10 @@ class PmdOperationTest {
@Test @Test
void testCache() throws ExitStatusException { void testCache() throws ExitStatusException {
var cache = Path.of("build/pmd/temp-cache"); var cache = Path.of("build/pmd/temp-cache");
var pmd = newPmdOperation().ruleSets(CODE_STYLE_XML).inputPaths(List.of(CODE_STYLE_SAMPLE)).cache(cache); var pmd = newPmdOperation()
.ruleSets(CODE_STYLE_XML)
.inputPaths(List.of(CODE_STYLE_SAMPLE))
.cache(cache);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
var f = cache.toFile(); var f = cache.toFile();
assertThat(f.exists()).as("file exits").isTrue(); assertThat(f.exists()).as("file exits").isTrue();
@ -213,7 +234,31 @@ class PmdOperationTest {
var pmd = newPmdOperation() var pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); .inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.inputPaths()).contains(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.inputPaths()).as("paths").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPaths(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile());
assertThat(pmd.inputPaths()).as("toFile()").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPaths(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString());
assertThat(pmd.inputPaths()).as("toString").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPathsFiles(List.of(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile()));
assertThat(pmd.inputPaths()).as("PathsFiles").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPathsStrings(List.of(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString()));
assertThat(pmd.inputPaths()).as("PathsStrings").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
} }
@ -235,6 +280,7 @@ class PmdOperationTest {
var pmd = newPmdOperation().ruleSets(CODE_STYLE_XML).inputPaths(CODE_STYLE_SAMPLE); var pmd = newPmdOperation().ruleSets(CODE_STYLE_XML).inputPaths(CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))) assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
.as("code style").isGreaterThan(0); .as("code style").isGreaterThan(0);
pmd = pmd.ruleSets(ERROR_PRONE_XML).inputPaths(ERROR_PRONE_SAMPLE); pmd = pmd.ruleSets(ERROR_PRONE_XML).inputPaths(ERROR_PRONE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))) assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
.as("code style + error prone").isGreaterThan(0); .as("code style + error prone").isGreaterThan(0);
@ -245,7 +291,7 @@ class PmdOperationTest {
var pmd = newPmdOperation() var pmd = newPmdOperation()
.ruleSets(DESIGN_XML) .ruleSets(DESIGN_XML)
.inputPaths("src/test/resources/java/Design.java") .inputPaths("src/test/resources/java/Design.java")
.cache(Path.of("build/pmd/design-cache")); .cache(new File("build/pmd/design-cache"));
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
} }
@ -336,6 +382,18 @@ class PmdOperationTest {
var config = pmd.initConfiguration(COMMAND_NAME); var config = pmd.initConfiguration(COMMAND_NAME);
assertThat(config.getRelativizeRoots()).isEqualTo(pmd.relativizeRoots()); assertThat(config.getRelativizeRoots()).isEqualTo(pmd.relativizeRoots());
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz, foo, bar, baz); assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz, foo, bar, baz);
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
.relativizeRootsFiles(List.of(foo.toFile(), bar.toFile(), baz.toFile()));
config = pmd.initConfiguration(COMMAND_NAME);
assertThat(config.getRelativizeRoots()).as("toFile").isEqualTo(pmd.relativizeRoots());
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz);
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
.relativizeRootsStrings(List.of(foo.toString(), bar.toString(), baz.toString()));
config = pmd.initConfiguration(COMMAND_NAME);
assertThat(config.getRelativizeRoots()).as("toString").isEqualTo(pmd.relativizeRoots());
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz);
} }
@Test @Test