public class ModuleTestSupport {
public static final String MODULE_NAME = "io.vividcode.store.common";
public static ModuleFinder getModuleFinder() throws URISyntaxException {
return ModuleFinder.of(
Paths.get(
ModuleDescriptorTest.class.getResource("/modules").toURI()));
}
public static ModuleReference getModuleReference() throws URISyntaxException {
return getModuleFinder().find(MODULE_NAME).get();
} }
Since I am sure that the module to find must exist, here I simply use the method get() of the returned Optional<ModuleReference> to retrieve the ModuleReference directly.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.