Path: blob/master/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java
40974 views
/*1* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 817653926* @summary Test use case when all java files are listed27* @modules28* jdk.javadoc/jdk.javadoc.internal.api29* jdk.javadoc/jdk.javadoc.internal.tool30* jdk.compiler/com.sun.tools.javac.api31* jdk.compiler/com.sun.tools.javac.main32* @library /tools/lib33* @build toolbox.ToolBox toolbox.TestRunner34* @run main CommandLineFiles35*/3637import java.nio.file.Path;38import java.nio.file.Paths;39import java.util.ArrayList;40import java.util.Arrays;41import java.util.List;42import java.util.stream.Collectors;4344import toolbox.*;4546public class CommandLineFiles extends ModuleTestBase {4748public static void main(String... args) throws Exception {49new CommandLineFiles().runTests();50}5152@Test53public void testExplicitJavaFiles(Path base) throws Exception {54Path src = Paths.get(base.toString(), "src");55Path mpath = Paths.get(src. toString(), "m");5657tb.writeJavaFiles(mpath,58"module m { exports p; }",59"package p; public class C { }");6061List<String> cmdList = new ArrayList<>();62cmdList.add("--source-path");63cmdList.add(mpath.toString());64Arrays.asList(tb.findJavaFiles(src)).stream()65.map(Path::toString)66.collect(Collectors.toCollection(() -> cmdList));67execTask(cmdList.toArray(new String[cmdList.size()]));68assertMessageNotPresent("warning:");69}7071}727374