52 */ |
52 */ |
53 @Test |
53 @Test |
54 public void testNoIndex() throws Exception { |
54 public void testNoIndex() throws Exception { |
55 JavaFileObject srcFile = createSimpleJavaFileObject(); |
55 JavaFileObject srcFile = createSimpleJavaFileObject(); |
56 DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); |
56 DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); |
57 StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null); |
57 try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { |
58 File outDir = getOutDir(); |
58 File outDir = getOutDir(); |
59 fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); |
59 fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); |
60 Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile); |
60 Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile); |
61 Iterable<String> options = Arrays.asList("-noindex"); |
61 Iterable<String> options = Arrays.asList("-noindex"); |
62 DocumentationTask t = tool.getTask(null, fm, null, null, options, files); |
62 DocumentationTask t = tool.getTask(null, fm, null, null, options, files); |
63 if (t.call()) { |
63 if (t.call()) { |
64 System.err.println("task succeeded"); |
64 System.err.println("task succeeded"); |
65 Set<String> expectFiles = new TreeSet<String>(standardExpectFiles); |
65 Set<String> expectFiles = new TreeSet<String>(standardExpectFiles); |
66 expectFiles.remove("index-all.html"); |
66 expectFiles.remove("index-all.html"); |
67 checkFiles(outDir, expectFiles); |
67 checkFiles(outDir, expectFiles); |
68 } else { |
68 } else { |
69 error("task failed"); |
69 error("task failed"); |
|
70 } |
70 } |
71 } |
71 } |
72 } |
72 |
73 |
73 /** |
74 /** |
74 * Verify null is handled correctly. |
75 * Verify null is handled correctly. |
75 */ |
76 */ |
76 @Test |
77 @Test |
77 public void testNull() throws Exception { |
78 public void testNull() throws Exception { |
78 JavaFileObject srcFile = createSimpleJavaFileObject(); |
79 JavaFileObject srcFile = createSimpleJavaFileObject(); |
79 DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); |
80 DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); |
80 StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null); |
81 try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { |
81 File outDir = getOutDir(); |
82 File outDir = getOutDir(); |
82 fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); |
83 fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); |
83 Iterable<String> options = Arrays.asList((String) null); |
84 Iterable<String> options = Arrays.asList((String) null); |
84 Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile); |
85 Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile); |
85 try { |
86 try { |
86 DocumentationTask t = tool.getTask(null, fm, null, null, options, files); |
87 DocumentationTask t = tool.getTask(null, fm, null, null, options, files); |
87 error("getTask succeeded, no exception thrown"); |
88 error("getTask succeeded, no exception thrown"); |
88 } catch (NullPointerException e) { |
89 } catch (NullPointerException e) { |
89 System.err.println("exception caught as expected: " + e); |
90 System.err.println("exception caught as expected: " + e); |
|
91 } |
90 } |
92 } |
91 } |
93 } |
92 |
94 |
93 } |
95 } |
94 |
96 |