115 }; |
115 }; |
116 } |
116 } |
117 |
117 |
118 @Test(dataProvider = "testrequires") |
118 @Test(dataProvider = "testrequires") |
119 public void testrequires(String name, String[][] expected) throws Exception { |
119 public void testrequires(String name, String[][] expected) throws Exception { |
120 String cmd1 = String.format("jdeps -inverse -modulepath %s -requires %s -addmods %s%n", |
120 String cmd1 = String.format("jdeps -inverse --module-path %s -requires %s --add-modules %s%n", |
121 MODS_DIR, name, modules.stream().collect(Collectors.joining(","))); |
121 MODS_DIR, name, modules.stream().collect(Collectors.joining(","))); |
122 |
122 |
123 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd1)) { |
123 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd1)) { |
124 jdeps.appModulePath(MODS_DIR.toString()) |
124 jdeps.appModulePath(MODS_DIR.toString()) |
125 .addmods(modules) |
125 .addmods(modules) |
126 .requires(Set.of(name)); |
126 .requires(Set.of(name)); |
127 |
127 |
128 runJdeps(jdeps, expected); |
128 runJdeps(jdeps, expected); |
129 } |
129 } |
130 |
130 |
131 String cmd2 = String.format("jdeps -inverse -modulepath %s -requires %s" + |
131 String cmd2 = String.format("jdeps -inverse --module-path %s -requires %s" + |
132 " -addmods ALL-MODULE-PATH%n", LIBS_DIR, name); |
132 " --add-modules ALL-MODULE-PATH%n", LIBS_DIR, name); |
133 |
133 |
134 // automatic module |
134 // automatic module |
135 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd2)) { |
135 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd2)) { |
136 jdeps.appModulePath(MODS_DIR.toString()) |
136 jdeps.appModulePath(MODS_DIR.toString()) |
137 .addmods(Set.of("ALL-MODULE-PATH")) |
137 .addmods(Set.of("ALL-MODULE-PATH")) |
162 }; |
162 }; |
163 } |
163 } |
164 |
164 |
165 @Test(dataProvider = "testpackage") |
165 @Test(dataProvider = "testpackage") |
166 public void testpackage(String name, String[][] expected) throws Exception { |
166 public void testpackage(String name, String[][] expected) throws Exception { |
167 String cmd = String.format("jdeps -inverse -modulepath %s -package %s -addmods %s%n", |
167 String cmd = String.format("jdeps -inverse --module-path %s -package %s --add-modules %s%n", |
168 MODS_DIR, name, modules.stream().collect(Collectors.joining(","))); |
168 MODS_DIR, name, modules.stream().collect(Collectors.joining(","))); |
169 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd)) { |
169 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd)) { |
170 jdeps.appModulePath(MODS_DIR.toString()) |
170 jdeps.appModulePath(MODS_DIR.toString()) |
171 .addmods(modules) |
171 .addmods(modules) |
172 .matchPackages(Set.of(name)); |
172 .matchPackages(Set.of(name)); |
193 }; |
193 }; |
194 } |
194 } |
195 |
195 |
196 @Test(dataProvider = "testregex") |
196 @Test(dataProvider = "testregex") |
197 public void testregex(String name, String[][] expected) throws Exception { |
197 public void testregex(String name, String[][] expected) throws Exception { |
198 String cmd = String.format("jdeps -inverse -modulepath %s -regex %s -addmods %s%n", |
198 String cmd = String.format("jdeps -inverse --module-path %s -regex %s --add-modules %s%n", |
199 MODS_DIR, name, modules.stream().collect(Collectors.joining(","))); |
199 MODS_DIR, name, modules.stream().collect(Collectors.joining(","))); |
200 |
200 |
201 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd)) { |
201 try (JdepsUtil.Command jdeps = JdepsUtil.newCommand(cmd)) { |
202 jdeps.appModulePath(MODS_DIR.toString()) |
202 jdeps.appModulePath(MODS_DIR.toString()) |
203 .addmods(modules) |
203 .addmods(modules) |