Added checks against all parameters
This commit is contained in:
parent
9de0095fbd
commit
10fd25ebf6
2 changed files with 68 additions and 2 deletions
|
@ -31,7 +31,25 @@ class DokkaOperationTest {
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"})
|
@SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"})
|
||||||
void executeConstructProcessCommandListTest() {
|
void executeConstructProcessCommandListTest() {
|
||||||
|
var params = List.of(
|
||||||
|
"-moduleName",
|
||||||
|
"-moduleVersion",
|
||||||
|
"-outputDir",
|
||||||
|
"-sourceSet",
|
||||||
|
"-pluginsConfiguration",
|
||||||
|
"-pluginsClasspath",
|
||||||
|
"-offlineMode",
|
||||||
|
"-failOnWarning",
|
||||||
|
"-delayTemplateSubstitution",
|
||||||
|
"-noSuppressObviousFunctions",
|
||||||
|
"-includes",
|
||||||
|
"-suppressInheritedMembers",
|
||||||
|
"-globalPackageOptions",
|
||||||
|
"-globalLinks",
|
||||||
|
"-globalSrcLink",
|
||||||
|
"-loggingLevel");
|
||||||
var examples = new File("examples");
|
var examples = new File("examples");
|
||||||
|
var jsonConf = new File("config.json");
|
||||||
var args = new DokkaOperation()
|
var args = new DokkaOperation()
|
||||||
.fromProject(new BaseProjectBlueprint(examples, "com.example", "Example"))
|
.fromProject(new BaseProjectBlueprint(examples, "com.example", "Example"))
|
||||||
.globalLinks("s", "link")
|
.globalLinks("s", "link")
|
||||||
|
@ -41,6 +59,7 @@ class DokkaOperationTest {
|
||||||
.globalSrcLink("link1", "link2")
|
.globalSrcLink("link1", "link2")
|
||||||
.globalSrcLink(List.of("link3", "link4"))
|
.globalSrcLink(List.of("link3", "link4"))
|
||||||
.includes("file1", "file2")
|
.includes("file1", "file2")
|
||||||
|
.includes(List.of("file3", "file4"))
|
||||||
.pluginConfigurations("name", "{\"json\"}")
|
.pluginConfigurations("name", "{\"json\"}")
|
||||||
.pluginConfigurations(Map.of("{\"name2\"}", "json2", "name3}", "{json3"))
|
.pluginConfigurations(Map.of("{\"name2\"}", "json2", "name3}", "{json3"))
|
||||||
.pluginsClasspath("path1", "path2")
|
.pluginsClasspath("path1", "path2")
|
||||||
|
@ -60,8 +79,20 @@ class DokkaOperationTest {
|
||||||
new File("examples/foo.jar"),
|
new File("examples/foo.jar"),
|
||||||
new File("examples/bar.jar")
|
new File("examples/bar.jar")
|
||||||
)))
|
)))
|
||||||
|
.json(jsonConf)
|
||||||
.executeConstructProcessCommandList();
|
.executeConstructProcessCommandList();
|
||||||
|
|
||||||
|
for (var p : params) {
|
||||||
|
var found = false;
|
||||||
|
for (var a : args) {
|
||||||
|
if (a.startsWith(p)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertThat(found).as(p + " not found.").isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
var path = examples.getAbsolutePath();
|
var path = examples.getAbsolutePath();
|
||||||
var dokkaJar = "1.9.20.jar";
|
var dokkaJar = "1.9.20.jar";
|
||||||
var matches = List.of("java",
|
var matches = List.of("java",
|
||||||
|
@ -78,14 +109,15 @@ class DokkaOperationTest {
|
||||||
"-globalLinks", "s^link^^s2^link2",
|
"-globalLinks", "s^link^^s2^link2",
|
||||||
"-globalPackageOptions", "option1;option2;option3;option4",
|
"-globalPackageOptions", "option1;option2;option3;option4",
|
||||||
"-globalSrcLinks_", "link1;link2;link3;link4",
|
"-globalSrcLinks_", "link1;link2;link3;link4",
|
||||||
"-includes", "file1;file2",
|
"-includes", "file1;file2;file3;file4",
|
||||||
"-loggingLevel", "debug",
|
"-loggingLevel", "debug",
|
||||||
"-moduleName", "name",
|
"-moduleName", "name",
|
||||||
"-moduleVersion", "1.0",
|
"-moduleVersion", "1.0",
|
||||||
"-noSuppressObviousFunctions",
|
"-noSuppressObviousFunctions",
|
||||||
"-offlineMode",
|
"-offlineMode",
|
||||||
"-pluginsConfiguration", "{\\\"name2\\\"}={json2}^^{name}={\\\"json\\\"}^^{name3}}={{json3}",
|
"-pluginsConfiguration", "{\\\"name2\\\"}={json2}^^{name}={\\\"json\\\"}^^{name3}}={{json3}",
|
||||||
"-suppressInheritedMembers");
|
"-suppressInheritedMembers",
|
||||||
|
jsonConf.getAbsolutePath());
|
||||||
|
|
||||||
assertThat(args).hasSize(matches.size());
|
assertThat(args).hasSize(matches.size());
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,29 @@ class SourceSetTest {
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
||||||
void sourceSetTest() {
|
void sourceSetTest() {
|
||||||
|
var params = List.of(
|
||||||
|
"-sourceSetName",
|
||||||
|
"-displayName",
|
||||||
|
"-classpath",
|
||||||
|
"-src",
|
||||||
|
"-dependentSourceSets",
|
||||||
|
"-samples",
|
||||||
|
"-includes",
|
||||||
|
"-documentedVisibilities",
|
||||||
|
"-reportUndocumented",
|
||||||
|
"-noSkipEmptyPackages",
|
||||||
|
"-skipDeprecated",
|
||||||
|
"-jdkVersion",
|
||||||
|
"-languageVersion",
|
||||||
|
"-apiVersion",
|
||||||
|
"-noStdlibLink",
|
||||||
|
"-noJdkLink",
|
||||||
|
"-suppressedFiles",
|
||||||
|
"-analysisPlatform",
|
||||||
|
"-perPackageOptions",
|
||||||
|
"-externalDocumentationLinks",
|
||||||
|
"-srcLink"
|
||||||
|
);
|
||||||
var sourceSet = new SourceSet()
|
var sourceSet = new SourceSet()
|
||||||
.classpath("classpath1", "classpath2")
|
.classpath("classpath1", "classpath2")
|
||||||
.dependentSourceSets("moduleName", "sourceSetName")
|
.dependentSourceSets("moduleName", "sourceSetName")
|
||||||
|
@ -80,6 +103,17 @@ class SourceSetTest {
|
||||||
|
|
||||||
var args = sourceSet.args();
|
var args = sourceSet.args();
|
||||||
|
|
||||||
|
for (var p : params) {
|
||||||
|
var found = false;
|
||||||
|
for (var a : args) {
|
||||||
|
if (a.startsWith(p)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertThat(found).as(p + " not found.").isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
var matches = List.of(
|
var matches = List.of(
|
||||||
"-analysisPlatform", "jvm",
|
"-analysisPlatform", "jvm",
|
||||||
"-apiVersion", "1.0",
|
"-apiVersion", "1.0",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue