1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.javadoc;
20
21 import java.io.File;
22 import java.io.IOException;
23 import java.net.HttpURLConnection;
24 import java.net.URL;
25 import java.nio.charset.Charset;
26 import java.nio.charset.StandardCharsets;
27 import java.nio.file.Files;
28 import java.nio.file.Path;
29 import java.nio.file.Paths;
30 import java.util.Collections;
31 import java.util.HashMap;
32 import java.util.List;
33 import java.util.Map;
34 import java.util.Objects;
35
36 import org.apache.commons.lang3.StringUtils;
37 import org.apache.maven.execution.MavenSession;
38 import org.apache.maven.model.Plugin;
39 import org.apache.maven.plugin.LegacySupport;
40 import org.apache.maven.plugin.MojoExecution;
41 import org.apache.maven.plugin.MojoExecutionException;
42 import org.apache.maven.plugin.MojoFailureException;
43 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
44 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
45 import org.apache.maven.plugins.javadoc.ProxyServer.AuthAsyncProxyServlet;
46 import org.apache.maven.project.MavenProject;
47 import org.apache.maven.project.ProjectBuildingRequest;
48 import org.apache.maven.project.ProjectBuildingRequest.RepositoryMerging;
49 import org.apache.maven.settings.Proxy;
50 import org.apache.maven.settings.Settings;
51 import org.apache.maven.shared.utils.io.FileUtils;
52 import org.codehaus.plexus.languages.java.version.JavaVersion;
53 import org.eclipse.aether.DefaultRepositorySystemSession;
54 import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
55 import org.eclipse.aether.repository.LocalRepository;
56 import org.hamcrest.MatcherAssert;
57 import org.junit.AssumptionViolatedException;
58 import org.slf4j.Logger;
59 import org.slf4j.LoggerFactory;
60
61 import static org.apache.commons.io.FileUtils.copyDirectory;
62 import static org.apache.commons.io.FileUtils.deleteDirectory;
63 import static org.assertj.core.api.Assertions.assertThat;
64 import static org.hamcrest.CoreMatchers.anyOf;
65 import static org.hamcrest.CoreMatchers.containsString;
66 import static org.hamcrest.CoreMatchers.is;
67 import static org.junit.Assume.assumeThat;
68 import static org.mockito.Mockito.mock;
69 import static org.mockito.Mockito.spy;
70 import static org.mockito.Mockito.when;
71
72
73
74
75
76
77
78 public class JavadocReportTest extends AbstractMojoTestCase {
79
80 private static final char LINE_SEPARATOR = ' ';
81
82 public static final String OPTIONS_UMLAUT_ENCODING = "Options Umlaut Encoding ö ä ü ß";
83
84 private Path unit;
85
86 private Path tempDirectory;
87
88 private File localRepo;
89
90 private static final Logger LOGGER = LoggerFactory.getLogger(JavadocReportTest.class);
91
92 @Override
93 protected void setUp() throws Exception {
94 super.setUp();
95
96 tempDirectory = Files.createTempDirectory("JavadocReportTest");
97 localRepo = tempDirectory.resolve(Paths.get("target/local-repo/")).toFile();
98 unit = new File(getBasedir(), "src/test/resources/unit").toPath();
99
100 createTestRepo();
101 }
102
103 @Override
104 protected void tearDown() throws Exception {
105 try {
106 deleteDirectory(tempDirectory.toFile());
107 } catch (IOException ex) {
108
109
110
111
112 }
113
114 super.tearDown();
115 }
116
117 private JavadocReport lookupMojo(Path testPom) throws Exception {
118 JavadocReport mojo = (JavadocReport) lookupMojo("javadoc", testPom.toFile());
119
120 Plugin p = new Plugin();
121 p.setGroupId("org.apache.maven.plugins");
122 p.setArtifactId("maven-javadoc-plugin");
123 MojoExecution mojoExecution = new MojoExecution(p, "javadoc", null);
124
125 setVariableValueToObject(mojo, "mojoExecution", mojoExecution);
126
127 MavenProject currentProject = new MavenProjectStub();
128 currentProject.setGroupId("GROUPID");
129 currentProject.setArtifactId("ARTIFACTID");
130
131 List<MavenProject> reactorProjects =
132 mojo.getReactorProjects() != null ? mojo.getReactorProjects() : Collections.emptyList();
133 MavenSession session = newMavenSession(currentProject);
134 setVariableValueToObject(mojo, "session", session);
135 setVariableValueToObject(mojo, "repoSession", session.getRepositorySession());
136 setVariableValueToObject(mojo, "reactorProjects", reactorProjects);
137 return mojo;
138 }
139
140
141
142
143
144
145 private void createTestRepo() throws IOException {
146 assertTrue(localRepo.mkdirs());
147
148
149
150
151
152 Path sourceDir = unit.resolve("doclet-test/artifact-doclet");
153 assertThat(sourceDir).exists();
154 copyDirectory(sourceDir.toFile(), localRepo);
155
156
157
158
159
160 sourceDir = unit.resolve("doclet-path-test/artifact-doclet");
161 assertThat(sourceDir).exists();
162 copyDirectory(sourceDir.toFile(), localRepo);
163
164
165
166
167
168
169 sourceDir = unit.resolve("taglet-test/artifact-taglet");
170 assertThat(sourceDir).exists();
171 copyDirectory(sourceDir.toFile(), localRepo);
172
173
174
175
176
177 sourceDir = unit.resolve("stylesheetfile-test/artifact-stylesheetfile");
178 assertThat(sourceDir).exists();
179 copyDirectory(sourceDir.toFile(), localRepo);
180
181
182
183
184
185 sourceDir = unit.resolve("helpfile-test/artifact-helpfile");
186 assertThat(sourceDir).exists();
187 copyDirectory(sourceDir.toFile(), localRepo);
188
189
190 List<String> files = FileUtils.getFileAndDirectoryNames(
191 localRepo, FileUtils.getDefaultExcludesAsString(), null, true, true, true, true);
192 for (String filename : files) {
193 File file = new File(filename);
194
195 if (file.isDirectory()) {
196 deleteDirectory(file);
197 } else {
198 file.delete();
199 }
200 }
201 }
202
203
204
205
206
207
208
209
210
211
212 private static String readFile(Path file) throws IOException {
213 return readFile(file, StandardCharsets.UTF_8);
214 }
215
216
217
218
219
220
221
222
223
224
225
226 private static String readFile(Path file, Charset cs) throws IOException {
227 StringBuilder str = new StringBuilder((int) Files.size(file));
228
229 for (String strTmp : Files.readAllLines(file, cs)) {
230 str.append(LINE_SEPARATOR);
231 str.append(strTmp);
232 }
233
234 return str.toString();
235 }
236
237
238
239
240
241
242 public void testDefaultConfiguration() throws Exception {
243 Path testPom = unit.resolve("default-configuration/default-configuration-plugin-config.xml");
244 JavadocReport mojo = lookupMojo(testPom);
245 mojo.execute();
246
247
248 Path apidocs = new File(getBasedir(), "target/test/unit/default-configuration/target/site/apidocs").toPath();
249
250 String appHtml = "def/configuration/App.html";
251 Path generatedFile = apidocs.resolve(appHtml);
252 assertThat(generatedFile).exists();
253
254 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore("16")) {
255 String url = Objects.requireNonNull(mojo.getDefaultJavadocApiLink()).getUrl();
256 HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
257 connection.setRequestMethod("HEAD");
258 try {
259
260 if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
261 try {
262 assumeThat(connection.getURL().toString(), is(url));
263
264
265 MatcherAssert.assertThat(
266 url + " available, but " + appHtml + " is missing link to java.lang.Object",
267 new String(Files.readAllBytes(generatedFile), StandardCharsets.UTF_8),
268 anyOf(
269 containsString("/docs/api/java/lang/Object.html"),
270 containsString("/docs/api/java.base/java/lang/Object.html")));
271 } catch (AssumptionViolatedException e) {
272 LOGGER.warn("ignoring defaultAPI check: {}", e.getMessage());
273 }
274 }
275 } catch (Exception e) {
276 LOGGER.error("error connecting to javadoc URL: {}", url);
277 throw e;
278 }
279 } else {
280 MatcherAssert.assertThat(
281 new String(Files.readAllBytes(generatedFile), StandardCharsets.UTF_8),
282 containsString("/docs/api/java.base/java/lang/Object.html"));
283 }
284
285 assertThat(apidocs.resolve("def/configuration/AppSample.html")).exists();
286 assertThat(apidocs.resolve("def/configuration/package-summary.html")).exists();
287 assertThat(apidocs.resolve("def/configuration/package-tree.html")).exists();
288 assertThat(apidocs.resolve("def/configuration/package-use.html")).exists();
289
290
291 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore("11")) {
292 assertThat(apidocs.resolve("def/configuration/package-frame.html")).exists();
293 assertThat(apidocs.resolve("allclasses-frame.html"))
294 .exists()
295 .content()
296 .containsOnlyOnce("def/configuration/App.html")
297 .containsOnlyOnce("def/configuration/AppSample.html");
298 assertThat(apidocs.resolve("allclasses-noframe.html"))
299 .exists()
300 .content()
301 .containsOnlyOnce("def/configuration/App.html")
302 .containsOnlyOnce("def/configuration/AppSample.html");
303 }
304
305
306 assertThat(apidocs.resolve("def/configuration/class-use/App.html")).exists();
307 assertThat(apidocs.resolve("def/configuration/class-use/AppSample.html"))
308 .exists();
309
310
311 assertThat(apidocs.resolve("constant-values.html")).exists();
312 assertThat(apidocs.resolve("deprecated-list.html")).exists();
313 assertThat(apidocs.resolve("help-doc.html")).exists();
314 assertThat(apidocs.resolve("index-all.html")).exists();
315 assertThat(apidocs.resolve("index.html")).exists();
316 assertThat(apidocs.resolve("overview-tree.html")).exists();
317 assertThat(apidocs.resolve("stylesheet.css")).exists();
318
319 if (JavaVersion.JAVA_VERSION.isAtLeast("10")) {
320 assertThat(apidocs.resolve("element-list")).exists();
321 } else {
322 assertThat(apidocs.resolve("package-list")).exists();
323 }
324 }
325
326
327
328
329
330
331 public void testSubpackages() throws Exception {
332 Path testPom = unit.resolve("subpackages-test/subpackages-test-plugin-config.xml");
333 JavadocReport mojo = lookupMojo(testPom);
334 mojo.execute();
335
336 Path apidocs = new File(getBasedir(), "target/test/unit/subpackages-test/target/site/apidocs").toPath();
337
338
339 assertThat(apidocs.resolve("subpackages/test/excluded")).doesNotExist();
340 assertThat(apidocs.resolve("subpackages/test/included/exclude")).doesNotExist();
341
342
343 assertThat(apidocs.resolve("subpackages/test/App.html")).exists();
344 assertThat(apidocs.resolve("subpackages/test/AppSample.html")).exists();
345 assertThat(apidocs.resolve("subpackages/test/included/IncludedApp.html"))
346 .exists();
347 assertThat(apidocs.resolve("subpackages/test/included/IncludedAppSample.html"))
348 .exists();
349 }
350
351 public void testIncludesExcludes() throws Exception {
352 Path testPom = unit.resolve("file-include-exclude-test/file-include-exclude-plugin-config.xml");
353 JavadocReport mojo = lookupMojo(testPom);
354 mojo.execute();
355
356 Path apidocs =
357 new File(getBasedir(), "target/test/unit/file-include-exclude-test/target/site/apidocs").toPath();
358
359
360 assertThat(apidocs.resolve("subpackages/test/App.html")).exists();
361 assertThat(apidocs.resolve("subpackages/test/AppSample.html")).exists();
362 assertThat(apidocs.resolve("subpackages/test/included/IncludedApp.html"))
363 .exists();
364 assertThat(apidocs.resolve("subpackages/test/included/IncludedAppSample.html"))
365 .exists();
366 assertThat(apidocs.resolve("subpackages/test/PariahApp.html")).doesNotExist();
367 }
368
369
370
371
372
373
374 public void testDocfiles() throws Exception {
375
376
377 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast("9")) {
378 return;
379 }
380
381 Path testPom = unit.resolve("docfiles-test/docfiles-test-plugin-config.xml");
382 JavadocReport mojo = lookupMojo(testPom);
383 mojo.execute();
384
385 Path apidocs = new File(getBasedir(), "target/test/unit/docfiles-test/target/site/apidocs/").toPath();
386
387
388 assertThat(apidocs.resolve("docfiles/test/doc-files")).exists();
389 assertThat(apidocs.resolve("docfiles/test/doc-files/included-dir1/sample-included1.gif"))
390 .exists();
391 assertThat(apidocs.resolve("docfiles/test/doc-files/included-dir2/sample-included2.gif"))
392 .exists();
393 assertThat(apidocs.resolve("docfiles/test/doc-files/excluded-dir1")).doesNotExist();
394 assertThat(apidocs.resolve("docfiles/test/doc-files/excluded-dir2")).doesNotExist();
395
396 testPom = unit.resolve("docfiles-with-java-test/docfiles-with-java-test-plugin-config.xml");
397 mojo = lookupMojo(testPom);
398 mojo.execute();
399 }
400
401
402
403
404
405
406
407 public void testCustomConfiguration() throws Exception {
408 Path testPom = unit.resolve("custom-configuration/custom-configuration-plugin-config.xml");
409 JavadocReport mojo = lookupMojo(testPom);
410 mojo.execute();
411
412 Path apidocs = new File(getBasedir(), "target/test/unit/custom-configuration/target/site/apidocs").toPath();
413
414
415 assertThat(apidocs.resolve("overview-tree.html")).doesNotExist();
416 assertThat(apidocs.resolve("custom/configuration/package-tree.html")).doesNotExist();
417
418
419 assertThat(apidocs.resolve("index-all.html")).doesNotExist();
420
421
422
423
424 assertThat(apidocs.resolve("deprecated-list.html")).doesNotExist();
425 assertThat(apidocs.resolve("custom/configuration/App.html")).doesNotExist();
426
427
428
429 String str = readFile(apidocs.resolve("custom/configuration/AppSample.html"));
430 assertFalse(str.toLowerCase().contains("author"));
431
432
433 assertTrue(str.toUpperCase().contains("SAMPLE BOTTOM CONTENT"));
434
435
436 if (JavaVersion.JAVA_VERSION.isBefore("11.0.2")) {
437 assertThat(str)
438 .containsIgnoringCase("href=\"http://java.sun.com/j2se/1.4.2/docs/api/java/lang/string.html");
439 } else {
440 assertTrue(str.toLowerCase()
441 .contains("href=\"http://java.sun.com/j2se/1.4.2/docs/api/java.base/java/lang/string.html"));
442 }
443
444
445 assertTrue(str.toUpperCase().contains("MAVEN JAVADOC PLUGIN TEST"));
446
447
448 if (JavaVersion.JAVA_VERSION.isBefore("16-ea")
449 && !System.getProperty("java.vm.name").contains("OpenJ9")) {
450 assertTrue(str.toUpperCase().contains("MAVEN JAVADOC PLUGIN TEST FOOTER"));
451 }
452
453
454 assertFalse(str.toUpperCase().contains("/HELP-DOC.HTML"));
455
456
457 assertThat(apidocs.resolve("custom/configuration/exclude1/Exclude1App.html"))
458 .exists();
459 assertThat(apidocs.resolve("custom/configuration/exclude1/subexclude/SubexcludeApp.html"))
460 .doesNotExist();
461 assertThat(apidocs.resolve("custom/configuration/exclude2/Exclude2App.html"))
462 .doesNotExist();
463
464 assertThat(apidocs.resolve("options")).isRegularFile();
465
466 String contentOptions = new String(Files.readAllBytes(apidocs.resolve("options")), StandardCharsets.UTF_8);
467
468 assertNotNull(contentOptions);
469 assertThat(contentOptions).contains("-link").contains("http://java.sun.com/j2se/");
470 }
471
472
473
474
475
476
477 public void testDoclets() throws Exception {
478 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast("13")) {
479
480 return;
481 }
482
483
484
485
486
487
488 Path testPom = unit.resolve("doclet-test/doclet-test-plugin-config.xml");
489 JavadocReport mojo = lookupMojo(testPom);
490
491 MavenSession session = spy(newMavenSession(mojo.project));
492 ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class);
493 when(buildingRequest.getRemoteRepositories()).thenReturn(mojo.project.getRemoteArtifactRepositories());
494 when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
495 DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
496 repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
497 .newInstance(repositorySession, new LocalRepository(localRepo)));
498 when(buildingRequest.getRepositorySession()).thenReturn(repositorySession);
499 when(session.getRepositorySession()).thenReturn(repositorySession);
500 LegacySupport legacySupport = lookup(LegacySupport.class);
501 legacySupport.setSession(session);
502
503 setVariableValueToObject(mojo, "session", session);
504 setVariableValueToObject(mojo, "repoSession", repositorySession);
505 mojo.execute();
506
507 Path generatedFile =
508 new File(getBasedir(), "target/test/unit/doclet-test/target/site/apidocs/graph.dot").toPath();
509 assertThat(generatedFile).exists();
510
511 Path optionsFile = new File(mojo.getPluginReportOutputDirectory(), "options").toPath();
512 assertThat(optionsFile).exists();
513 String options = readFile(optionsFile);
514 assertThat(options).contains("/target/local-repo/umlgraph/UMLGraph/2.1/UMLGraph-2.1.jar");
515
516
517
518
519
520
521 testPom = unit.resolve("doclet-path-test/doclet-path-test-plugin-config.xml");
522 mojo = lookupMojo(testPom);
523 setVariableValueToObject(mojo, "session", session);
524 setVariableValueToObject(mojo, "repoSession", repositorySession);
525 mojo.execute();
526
527 generatedFile = new File(getBasedir(), "target/test/unit/doclet-test/target/site/apidocs/graph.dot").toPath();
528 assertThat(generatedFile).exists();
529
530 optionsFile = new File(mojo.getPluginReportOutputDirectory(), "options").toPath();
531 assertThat(optionsFile).exists();
532 options = readFile(optionsFile);
533 assertThat(options)
534 .contains("/target/local-repo/umlgraph/UMLGraph/2.1/UMLGraph-2.1.jar")
535 .contains("/target/local-repo/umlgraph/UMLGraph-bis/2.1/UMLGraph-bis-2.1.jar");
536 }
537
538
539
540
541
542
543 public void testQuotedPath() throws Exception {
544 Path testPom = unit.resolve("quotedpath'test/quotedpath-test-plugin-config.xml");
545 JavadocReport mojo = lookupMojo(testPom);
546 mojo.execute();
547
548 Path apidocs = new File(getBasedir(), "target/test/unit/quotedpath'test/target/site/apidocs").toPath();
549
550
551 assertThat(apidocs.resolve("quotedpath/test/App.html")).exists();
552 assertThat(apidocs.resolve("quotedpath/test/AppSample.html")).exists();
553
554
555 assertThat(apidocs.resolve("index-all.html")).exists();
556 assertThat(apidocs.resolve("index.html")).exists();
557 assertThat(apidocs.resolve("overview-tree.html")).exists();
558 assertThat(apidocs.resolve("stylesheet.css")).exists();
559
560 if (JavaVersion.JAVA_VERSION.isBefore("10")) {
561 assertThat(apidocs.resolve("package-list")).exists();
562 } else {
563 assertThat(apidocs.resolve("element-list")).exists();
564 }
565 }
566
567
568
569
570
571
572 public void testOptionsUmlautEncoding() throws Exception {
573 Path testPom = unit.resolve("optionsumlautencoding-test/optionsumlautencoding-test-plugin-config.xml");
574 JavadocReport mojo = lookupMojo(testPom);
575 mojo.execute();
576
577 Path optionsFile = new File(mojo.getPluginReportOutputDirectory(), "options").toPath();
578 assertThat(optionsFile).exists();
579
580
581 String content;
582 String expected;
583 if (JavaVersion.JAVA_VERSION.isAtLeast("9") && JavaVersion.JAVA_VERSION.isBefore("12")) {
584 content = readFile(optionsFile, StandardCharsets.UTF_8);
585 expected = OPTIONS_UMLAUT_ENCODING;
586 } else {
587 content = readFile(optionsFile, Charset.defaultCharset());
588 expected = new String(OPTIONS_UMLAUT_ENCODING.getBytes(Charset.defaultCharset()));
589 }
590
591 assertThat(content).contains(expected);
592
593 Path apidocs =
594 new File(getBasedir(), "target/test/unit/optionsumlautencoding-test/target/site/apidocs").toPath();
595
596
597 assertThat(apidocs.resolve("optionsumlautencoding/test/App.html")).exists();
598 assertThat(apidocs.resolve("optionsumlautencoding/test/AppSample.html")).exists();
599
600
601 assertThat(apidocs.resolve("index-all.html")).exists();
602 assertThat(apidocs.resolve("index.html")).exists();
603 assertThat(apidocs.resolve("overview-tree.html")).exists();
604 assertThat(apidocs.resolve("stylesheet.css")).exists();
605
606 if (JavaVersion.JAVA_VERSION.isBefore("10")) {
607 assertThat(apidocs.resolve("package-list")).exists();
608 } else {
609 assertThat(apidocs.resolve("element-list")).exists();
610 }
611 }
612
613
614
615
616
617
618 public void testTaglets() throws Exception {
619
620
621
622
623
624
625
626 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast("10")) {
627 return;
628 }
629
630 Path testPom = unit.resolve("taglet-test/taglet-test-plugin-config.xml");
631 JavadocReport mojo = lookupMojo(testPom);
632
633 MavenSession session = spy(newMavenSession(mojo.project));
634 ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class);
635 when(buildingRequest.getRemoteRepositories()).thenReturn(mojo.project.getRemoteArtifactRepositories());
636 when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
637 DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
638 repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
639 .newInstance(repositorySession, new LocalRepository(localRepo)));
640 when(buildingRequest.getRepositorySession()).thenReturn(repositorySession);
641 when(session.getRepositorySession()).thenReturn(repositorySession);
642 LegacySupport legacySupport = lookup(LegacySupport.class);
643 legacySupport.setSession(session);
644
645 setVariableValueToObject(mojo, "session", session);
646 setVariableValueToObject(mojo, "repoSession", repositorySession);
647
648 mojo.execute();
649
650 Path apidocs = new File(getBasedir(), "target/test/unit/taglet-test/target/site/apidocs").toPath();
651
652 assertThat(apidocs.resolve("index.html")).exists();
653
654 Path appFile = apidocs.resolve("taglet/test/App.html");
655 assertThat(appFile).exists();
656 String appString = readFile(appFile);
657 assertThat(appString).contains("<b>To Do:</b>");
658 }
659
660
661
662
663
664
665 public void testJdk5() throws Exception {
666
667
668 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast("9")) {
669 return;
670 }
671
672 Path testPom = unit.resolve("jdk5-test/jdk5-test-plugin-config.xml");
673 JavadocReport mojo = lookupMojo(testPom);
674 mojo.execute();
675
676 Path apidocs = new File(getBasedir(), "target/test/unit/jdk5-test/target/site/apidocs").toPath();
677
678 assertThat(apidocs.resolve("index.html")).exists();
679
680 Path overviewSummary = apidocs.resolve("overview-summary.html");
681 assertThat(overviewSummary).exists();
682 String content = readFile(overviewSummary);
683 assertThat(content).contains("<b>Test the package-info</b>");
684
685 Path packageSummary = apidocs.resolve("jdk5/test/package-summary.html");
686 assertThat(packageSummary).exists();
687 content = readFile(packageSummary);
688 assertThat(content).contains("<b>Test the package-info</b>");
689 }
690
691
692
693
694
695
696
697 public void testToFindJavadoc() throws Exception {
698 String oldJreHome = System.getProperty("java.home");
699 System.setProperty("java.home", "foo/bar");
700
701 Path testPom = unit.resolve("javaHome-test/javaHome-test-plugin-config.xml");
702 JavadocReport mojo = lookupMojo(testPom);
703 mojo.execute();
704
705 System.setProperty("java.home", oldJreHome);
706 }
707
708
709
710
711
712
713 public void testJavadocResources() throws Exception {
714 Path testPom = unit.resolve("resources-test/resources-test-plugin-config.xml");
715 JavadocReport mojo = lookupMojo(testPom);
716 mojo.execute();
717
718 Path apidocs = new File(getBasedir(), "target/test/unit/resources-test/target/site/apidocs/").toPath();
719
720 Path app = apidocs.resolve("resources/test/App.html");
721 assertThat(app).exists();
722 String content = readFile(app);
723 assertThat(content).contains("<img src=\"doc-files/maven-feather.png\" alt=\"Maven\">");
724 assertThat(apidocs.resolve("resources/test/doc-files/maven-feather.png"))
725 .exists();
726
727 Path app2 = apidocs.resolve("resources/test2/App2.html");
728 assertThat(app2).exists();
729 content = readFile(app2);
730 assertThat(content).contains("<img src=\"doc-files/maven-feather.png\" alt=\"Maven\">");
731 assertThat(apidocs.resolve("resources/test2/doc-files/maven-feather.png"))
732 .doesNotExist();
733
734
735 testPom = unit.resolve("resources-with-excludes-test/resources-with-excludes-test-plugin-config.xml");
736 mojo = lookupMojo(testPom);
737 mojo.execute();
738
739 apidocs = new File(getBasedir(), "target/test/unit/resources-with-excludes-test/target/site/apidocs").toPath();
740
741 app = apidocs.resolve("resources/test/App.html");
742 assertThat(app).exists();
743 content = readFile(app);
744 assertThat(content).contains("<img src=\"doc-files/maven-feather.png\" alt=\"Maven\">");
745
746 JavaVersion javadocVersion = (JavaVersion) getVariableValueFromObject(mojo, "javadocRuntimeVersion");
747 if (javadocVersion.isAtLeast("1.8") ) {
748
749 assertThat(apidocs.resolve("resources/test/doc-files/maven-feather.png"))
750 .as("Javadoc runtime version: " + javadocVersion
751 + "\nThis bug appeared in JDK8 and was planned to be fixed in JDK9, see JDK-8032205")
752 .exists();
753 } else {
754 assertThat(apidocs.resolve("resources/test/doc-files/maven-feather.png"))
755 .doesNotExist();
756 }
757 assertThat(apidocs.resolve("resources/test2/doc-files/maven-feather.png"))
758 .exists();
759
760 app2 = apidocs.resolve("resources/test2/App2.html");
761 assertThat(app2).exists();
762 content = readFile(app2);
763 assertThat(content).contains("<img src=\"doc-files/maven-feather.png\" alt=\"Maven\">");
764 assertThat(apidocs.resolve("resources/test2/doc-files/maven-feather.png"))
765 .exists();
766 }
767
768
769
770
771
772
773 public void testPom() throws Exception {
774 Path testPom = unit.resolve("pom-test/pom-test-plugin-config.xml");
775 JavadocReport mojo = lookupMojo(testPom);
776 mojo.execute();
777
778 assertThat(new File(getBasedir(), "target/test/unit/pom-test/target/site"))
779 .doesNotExist();
780 }
781
782
783
784
785
786
787 public void testTag() throws Exception {
788 Path testPom = unit.resolve("tag-test/tag-test-plugin-config.xml");
789 JavadocReport mojo = lookupMojo(testPom);
790 mojo.execute();
791
792 Path app = new File(getBasedir(), "target/test/unit/tag-test/target/site/apidocs/tag/test/App.html").toPath();
793 assertThat(app).exists();
794 String readed = readFile(app);
795 assertThat(readed).contains(">To do something:</").contains(">Generator Class:</");
796
797
798
799 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore("11")) {
800 assertThat(readed).contains(">Version:</");
801 assertTrue(readed.toLowerCase().contains("</dt>" + LINE_SEPARATOR + " <dd>1.0</dd>")
802 || readed.toLowerCase().contains("</dt>" + LINE_SEPARATOR + "<dd>1.0</dd>" ));
803 }
804 }
805
806
807
808
809
810
811 public void testHeaderFooter() throws Exception {
812 Path testPom = unit.resolve("header-footer-test/header-footer-test-plugin-config.xml");
813 JavadocReport mojo = lookupMojo(testPom);
814 try {
815 mojo.execute();
816 } catch (MojoExecutionException e) {
817 fail("Doesnt handle correctly newline for header or footer parameter");
818 }
819 }
820
821
822
823
824
825
826 public void testNewline() throws Exception {
827 Path testPom = unit.resolve("newline-test/newline-test-plugin-config.xml");
828 JavadocReport mojo = lookupMojo(testPom);
829 try {
830 mojo.execute();
831 } catch (MojoExecutionException e) {
832 fail("Doesn't handle correctly newline for string parameters. See options and packages files.");
833 }
834 }
835
836
837
838
839
840
841 public void testJdk6() throws Exception {
842
843
844 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast("12")) {
845 return;
846 }
847
848 Path testPom = unit.resolve("jdk6-test/jdk6-test-plugin-config.xml");
849 JavadocReport mojo = lookupMojo(testPom);
850 mojo.execute();
851
852 Path apidocs = new File(getBasedir(), "target/test/unit/jdk6-test/target/site/apidocs").toPath();
853 assertThat(apidocs.resolve("index.html")).exists();
854
855 Path overview;
856 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore("11")) {
857 overview = apidocs.resolve("overview-summary.html");
858 } else {
859 overview = apidocs.resolve("index.html");
860 }
861
862 assertThat(overview).exists();
863 String content = readFile(overview);
864 assertThat(content)
865 .contains("Top - Copyright © All rights reserved.")
866 .contains("Header - Copyright © All rights reserved.");
867
868 if (!System.getProperty("java.vm.name").contains("OpenJ9")) {
869 assertThat(content).contains("Footer - Copyright © All rights reserved.");
870 }
871
872 Path packageSummary = apidocs.resolve("jdk6/test/package-summary.html");
873 assertThat(packageSummary).exists();
874 content = readFile(packageSummary);
875 assertThat(content)
876 .contains("Top - Copyright © All rights reserved.")
877 .contains("Header - Copyright © All rights reserved.");
878
879
880 if (!System.getProperty("java.vm.name").contains("OpenJ9")) {
881 assertThat(content).contains("Footer - Copyright © All rights reserved.");
882 }
883 }
884
885
886
887
888
889
890 public void testProxy() throws Exception {
891 Settings settings = new Settings();
892 Proxy proxy = new Proxy();
893
894
895 proxy.setActive(true);
896 proxy.setHost("127.0.0.1");
897 proxy.setPort(80);
898 proxy.setProtocol("http");
899 proxy.setUsername("toto");
900 proxy.setPassword("toto");
901 proxy.setNonProxyHosts("www.google.com|*.somewhere.com");
902 settings.addProxy(proxy);
903
904 Path testPom =
905 new File(getBasedir(), "src/test/resources/unit/proxy-test/proxy-test-plugin-config.xml").toPath();
906 JavadocReport mojo = lookupMojo(testPom);
907
908 MavenSession session = spy(newMavenSession(mojo.project));
909 ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class);
910 when(buildingRequest.getRemoteRepositories()).thenReturn(mojo.project.getRemoteArtifactRepositories());
911 when(buildingRequest.getRepositoryMerging()).thenReturn(RepositoryMerging.POM_DOMINANT);
912 when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
913 DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
914 repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
915 .newInstance(repositorySession, new LocalRepository(localRepo)));
916 when(buildingRequest.getRepositorySession()).thenReturn(repositorySession);
917 when(session.getRepositorySession()).thenReturn(repositorySession);
918 LegacySupport legacySupport = lookup(LegacySupport.class);
919 legacySupport.setSession(session);
920
921 setVariableValueToObject(mojo, "settings", settings);
922 setVariableValueToObject(mojo, "session", session);
923 setVariableValueToObject(mojo, "repoSession", repositorySession);
924 mojo.execute();
925
926 Path commandLine = new File(
927 getBasedir(),
928 "target/test/unit/proxy-test/target/site/apidocs/javadoc."
929 + (SystemUtils.IS_OS_WINDOWS ? "bat" : "sh"))
930 .toPath();
931 assertThat(commandLine).exists();
932 String readed = readFile(commandLine);
933 assertThat(readed).contains("-J-Dhttp.proxyHost=127.0.0.1").contains("-J-Dhttp.proxyPort=80");
934 if (SystemUtils.IS_OS_WINDOWS) {
935 assertThat(readed).contains(" -J-Dhttp.nonProxyHosts=\"www.google.com^|*.somewhere.com\" ");
936 } else {
937 assertThat(readed).contains(" \"-J-Dhttp.nonProxyHosts=\\\"www.google.com^|*.somewhere.com\\\"\" ");
938 }
939
940 Path options = new File(getBasedir(), "target/test/unit/proxy-test/target/site/apidocs/options").toPath();
941 assertThat(options).exists();
942 String optionsContent = readFile(options);
943
944 assertThat(optionsContent).doesNotContain("-link");
945
946
947 ProxyServer proxyServer = null;
948 AuthAsyncProxyServlet proxyServlet;
949 try {
950 proxyServlet = new AuthAsyncProxyServlet();
951 proxyServer = new ProxyServer(proxyServlet);
952 proxyServer.start();
953
954 settings = new Settings();
955 proxy = new Proxy();
956 proxy.setActive(true);
957 proxy.setHost(proxyServer.getHostName());
958 proxy.setPort(proxyServer.getPort());
959 proxy.setProtocol("http");
960 settings.addProxy(proxy);
961
962 mojo = lookupMojo(testPom);
963 setVariableValueToObject(mojo, "settings", settings);
964 setVariableValueToObject(mojo, "session", session);
965 setVariableValueToObject(mojo, "repoSession", repositorySession);
966 mojo.execute();
967 readed = readFile(commandLine);
968 assertTrue(readed.contains("-J-Dhttp.proxyHost=" + proxyServer.getHostName()));
969 assertTrue(readed.contains("-J-Dhttp.proxyPort=" + proxyServer.getPort()));
970
971 optionsContent = readFile(options);
972
973
974
975
976
977
978
979
980
981
982 } finally {
983 if (proxyServer != null) {
984 proxyServer.stop();
985 }
986 }
987
988
989 Map<String, String> authentications = new HashMap<>();
990 authentications.put("foo", "bar");
991 try {
992 proxyServlet = new AuthAsyncProxyServlet(authentications);
993 proxyServer = new ProxyServer(proxyServlet);
994 proxyServer.start();
995
996 settings = new Settings();
997 proxy = new Proxy();
998 proxy.setActive(true);
999 proxy.setHost(proxyServer.getHostName());
1000 proxy.setPort(proxyServer.getPort());
1001 proxy.setProtocol("http");
1002 proxy.setUsername("foo");
1003 proxy.setPassword("bar");
1004 settings.addProxy(proxy);
1005
1006 mojo = lookupMojo(testPom);
1007 setVariableValueToObject(mojo, "settings", settings);
1008 setVariableValueToObject(mojo, "session", session);
1009 setVariableValueToObject(mojo, "repoSession", repositorySession);
1010 mojo.execute();
1011 readed = readFile(commandLine);
1012 assertThat(readed)
1013 .contains("-J-Dhttp.proxyHost=" + proxyServer.getHostName())
1014 .contains("-J-Dhttp.proxyPort=" + proxyServer.getPort());
1015
1016 optionsContent = readFile(options);
1017
1018
1019
1020 } finally {
1021 if (proxyServer != null) {
1022 proxyServer.stop();
1023 }
1024 }
1025 }
1026
1027
1028
1029
1030
1031
1032 public void testValidateOptions() throws Exception {
1033
1034 Path testPom = unit.resolve("validate-options-test/wrong-encoding-test-plugin-config.xml");
1035 JavadocReport mojo = lookupMojo(testPom);
1036 try {
1037 mojo.execute();
1038 fail("No wrong encoding catch");
1039 } catch (MojoExecutionException e) {
1040 assertTrue("No wrong encoding catch", e.getMessage().contains("Unsupported option <encoding/>"));
1041 }
1042 testPom = unit.resolve("validate-options-test/wrong-docencoding-test-plugin-config.xml");
1043 mojo = lookupMojo(testPom);
1044 try {
1045 mojo.execute();
1046 fail("No wrong docencoding catch");
1047 } catch (MojoExecutionException e) {
1048 assertTrue("No wrong docencoding catch", e.getMessage().contains("Unsupported option <docencoding/>"));
1049 }
1050 testPom = unit.resolve("validate-options-test/wrong-charset-test-plugin-config.xml");
1051 mojo = lookupMojo(testPom);
1052 try {
1053 mojo.execute();
1054 fail("No wrong charset catch");
1055 } catch (MojoExecutionException e) {
1056 assertTrue("No wrong charset catch", e.getMessage().contains("Unsupported option <charset/>"));
1057 }
1058
1059 testPom = unit.resolve("validate-options-test/wrong-locale-with-variant-test-plugin-config.xml");
1060 mojo = lookupMojo(testPom);
1061 mojo.execute();
1062 assertTrue("No wrong locale catch", true);
1063
1064
1065 testPom = unit.resolve("validate-options-test/conflict-options-test-plugin-config.xml");
1066 mojo = lookupMojo(testPom);
1067 try {
1068 mojo.execute();
1069 fail("No conflict catch");
1070 } catch (MojoExecutionException e) {
1071 assertTrue("No conflict catch", e.getMessage().contains("Option <nohelp/> conflicts with <helpfile/>"));
1072 }
1073 }
1074
1075
1076
1077
1078
1079
1080 public void testTagletArtifacts() throws Exception {
1081
1082
1083 if (JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast("10")) {
1084 return;
1085 }
1086
1087 Path testPom = unit.resolve("tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml");
1088 JavadocReport mojo = lookupMojo(testPom);
1089
1090 MavenSession session = newMavenSession(mojo.project);
1091 DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession();
1092 repoSysSession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
1093 .newInstance(session.getRepositorySession(), new LocalRepository(new File("target/local-repo"))));
1094
1095 LegacySupport legacySupport = lookup(LegacySupport.class);
1096 legacySupport.setSession(session);
1097 setVariableValueToObject(mojo, "session", session);
1098 setVariableValueToObject(mojo, "repoSession", repoSysSession);
1099 mojo.execute();
1100
1101 Path optionsFile = new File(mojo.getPluginReportOutputDirectory(), "options").toPath();
1102 assertThat(optionsFile).exists();
1103 String options = readFile(optionsFile);
1104
1105 assertThat(StringUtils.countMatches(options, LINE_SEPARATOR + "-taglet" + LINE_SEPARATOR))
1106 .isEqualTo(3);
1107 assertThat(options)
1108 .contains("org.codehaus.plexus.javadoc.PlexusConfigurationTaglet")
1109 .contains("org.codehaus.plexus.javadoc.PlexusRequirementTaglet")
1110 .contains("org.codehaus.plexus.javadoc.PlexusComponentTaglet");
1111 }
1112
1113
1114
1115
1116
1117
1118 public void testStylesheetfile() throws Exception {
1119 Path testPom = unit.resolve("stylesheetfile-test/pom.xml");
1120
1121 JavadocReport mojo = lookupMojo(testPom);
1122 assertNotNull(mojo);
1123
1124 MavenSession session = spy(newMavenSession(mojo.project));
1125 ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class);
1126 when(buildingRequest.getRemoteRepositories()).thenReturn(mojo.project.getRemoteArtifactRepositories());
1127 when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
1128 DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
1129 repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
1130 .newInstance(repositorySession, new LocalRepository(localRepo)));
1131 when(buildingRequest.getRepositorySession()).thenReturn(repositorySession);
1132 when(session.getRepositorySession()).thenReturn(repositorySession);
1133 LegacySupport legacySupport = lookup(LegacySupport.class);
1134 legacySupport.setSession(session);
1135 setVariableValueToObject(mojo, "session", session);
1136 setVariableValueToObject(mojo, "repoSession", repositorySession);
1137
1138 Path apidocs = new File(getBasedir(), "target/test/unit/stylesheetfile-test/target/site/apidocs").toPath();
1139
1140 Path stylesheetfile = apidocs.resolve("stylesheet.css");
1141 Path options = apidocs.resolve("options");
1142
1143
1144 setVariableValueToObject(mojo, "stylesheet", "javamaven");
1145
1146 try {
1147 mojo.execute();
1148 fail();
1149 } catch (MojoExecutionException | MojoFailureException e) {
1150 }
1151
1152
1153 setVariableValueToObject(mojo, "stylesheet", "java");
1154 mojo.execute();
1155
1156 String content = readFile(stylesheetfile);
1157 if (JavaVersion.JAVA_VERSION.isAtLeast("13-ea")) {
1158 assertTrue(content.contains("/*" + LINE_SEPARATOR + " * Javadoc style sheet" + LINE_SEPARATOR + " */"));
1159 } else if (JavaVersion.JAVA_VERSION.isAtLeast("10")) {
1160 assertTrue(content.contains("/* " + LINE_SEPARATOR + " * Javadoc style sheet" + LINE_SEPARATOR + " */"));
1161 } else {
1162 assertTrue(content.contains("/* Javadoc style sheet */"));
1163 }
1164
1165 String optionsContent = readFile(options);
1166 assertFalse(optionsContent.contains("-stylesheetfile"));
1167
1168
1169 setVariableValueToObject(mojo, "stylesheet", null);
1170 setVariableValueToObject(mojo, "stylesheetfile", "com/mycompany/app/javadoc/css/stylesheet.css");
1171 mojo.execute();
1172
1173 content = readFile(stylesheetfile);
1174 assertTrue(content.contains("/* Custom Javadoc style sheet in project */"));
1175
1176 optionsContent = readFile(options);
1177 assertTrue(optionsContent.contains("-stylesheetfile"));
1178 Path stylesheetResource =
1179 unit.resolve("stylesheetfile-test/src/main/resources/com/mycompany/app/javadoc/css/stylesheet.css");
1180 assertTrue(optionsContent.contains(
1181 "'" + stylesheetResource.toFile().getAbsolutePath().replaceAll("\\\\", "/") + "'"));
1182
1183
1184 setVariableValueToObject(mojo, "stylesheetfile", "com/mycompany/app/javadoc/css2/stylesheet.css");
1185 mojo.execute();
1186
1187 content = readFile(stylesheetfile);
1188 assertTrue(content.contains("/* Custom Javadoc style sheet in artefact */"));
1189
1190 optionsContent = readFile(options);
1191 assertTrue(optionsContent.contains("-stylesheetfile"));
1192 assertTrue(optionsContent.contains(
1193 "'" + stylesheetfile.toFile().getAbsolutePath().replaceAll("\\\\", "/") + "'"));
1194
1195
1196 Path css = unit.resolve("stylesheetfile-test/src/main/resources/com/mycompany/app/javadoc/css3/stylesheet.css");
1197 setVariableValueToObject(mojo, "stylesheetfile", css.toFile().getAbsolutePath());
1198 mojo.execute();
1199
1200 content = readFile(stylesheetfile);
1201 assertTrue(content.contains("/* Custom Javadoc style sheet as file */"));
1202
1203 optionsContent = readFile(options);
1204 assertTrue(optionsContent.contains("-stylesheetfile"));
1205 stylesheetResource =
1206 unit.resolve("stylesheetfile-test/src/main/resources/com/mycompany/app/javadoc/css3/stylesheet.css");
1207 assertTrue(optionsContent.contains(
1208 "'" + stylesheetResource.toFile().getAbsolutePath().replaceAll("\\\\", "/") + "'"));
1209 }
1210
1211
1212
1213
1214
1215
1216 public void testHelpfile() throws Exception {
1217 Path testPom = unit.resolve("helpfile-test/pom.xml");
1218
1219 JavadocReport mojo = lookupMojo(testPom);
1220 assertNotNull(mojo);
1221
1222 MavenSession session = spy(newMavenSession(mojo.project));
1223 ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class);
1224 when(buildingRequest.getRemoteRepositories()).thenReturn(mojo.project.getRemoteArtifactRepositories());
1225 when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
1226 DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
1227 repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
1228 .newInstance(repositorySession, new LocalRepository(localRepo)));
1229 when(buildingRequest.getRepositorySession()).thenReturn(repositorySession);
1230 when(session.getRepositorySession()).thenReturn(repositorySession);
1231 LegacySupport legacySupport = lookup(LegacySupport.class);
1232 legacySupport.setSession(session);
1233 setVariableValueToObject(mojo, "session", session);
1234 setVariableValueToObject(mojo, "repoSession", repositorySession);
1235
1236 Path apidocs = new File(getBasedir(), "target/test/unit/helpfile-test/target/site/apidocs").toPath();
1237
1238 Path helpfile = apidocs.resolve("help-doc.html");
1239 Path options = apidocs.resolve("options");
1240
1241
1242 mojo.execute();
1243
1244 String content = readFile(helpfile);
1245 assertTrue(content.contains("<!-- Generated by javadoc"));
1246
1247 String optionsContent = readFile(options);
1248 assertFalse(optionsContent.contains("-helpfile"));
1249
1250
1251 setVariableValueToObject(mojo, "helpfile", "com/mycompany/app/javadoc/helpfile/help-doc.html");
1252
1253 setVariableValueToObject(mojo, "session", session);
1254 setVariableValueToObject(mojo, "repoSession", repositorySession);
1255
1256 mojo.execute();
1257
1258 content = readFile(helpfile);
1259 assertTrue(content.contains("<!-- Help file from artefact -->"));
1260
1261 optionsContent = readFile(options);
1262 assertTrue(optionsContent.contains("-helpfile"));
1263 Path help = apidocs.resolve("help-doc.html");
1264 assertTrue(optionsContent.contains("'" + help.toFile().getAbsolutePath().replaceAll("\\\\", "/") + "'"));
1265
1266
1267 setVariableValueToObject(mojo, "helpfile", "com/mycompany/app/javadoc/helpfile2/help-doc.html");
1268 mojo.execute();
1269
1270 content = readFile(helpfile);
1271 assertTrue(content.contains("<!-- Help file from file -->"));
1272
1273 optionsContent = readFile(options);
1274 assertTrue(optionsContent.contains("-helpfile"));
1275 help = unit.resolve("helpfile-test/src/main/resources/com/mycompany/app/javadoc/helpfile2/help-doc.html");
1276 assertTrue(optionsContent.contains("'" + help.toFile().getAbsolutePath().replaceAll("\\\\", "/") + "'"));
1277
1278
1279 help = unit.resolve("helpfile-test/src/main/resources/com/mycompany/app/javadoc/helpfile2/help-doc.html");
1280 setVariableValueToObject(mojo, "helpfile", help.toFile().getAbsolutePath());
1281 mojo.execute();
1282
1283 content = readFile(helpfile);
1284 assertTrue(content.contains("<!-- Help file from file -->"));
1285
1286 optionsContent = readFile(options);
1287 assertTrue(optionsContent.contains("-helpfile"));
1288 assertTrue(optionsContent.contains("'" + help.toFile().getAbsolutePath().replaceAll("\\\\", "/") + "'"));
1289 }
1290 }