MCPcopy Index your code
hub / github.com/PCGen/pcgen / checkPluginJar

Method checkPluginJar

code/src/test/plugin/PluginBuildTest.java:177–201  ·  view source on GitHub ↗
(Path jar, Path sourceFolder)

Source from the content-addressed store, hash-verified

175 }
176
177 private void checkPluginJar(Path jar, Path sourceFolder) throws IOException
178 {
179 try (Stream<Path> stream = Files.walk(sourceFolder)) {
180 var javaPlugins = stream
181 .filter(Files::isRegularFile)
182 .map(Path::getFileName)
183 .map(Path::toString)
184 .filter(s -> s.endsWith(JAVA_EXT))
185 .map(s -> s.substring(0, s.length() - JAVA_EXT.length()))
186 .collect(Collectors.toSet());
187
188 try (JarFile jarFile = new JarFile(jar.toFile())) {
189 var res = jarFile.stream()
190 .map(JarEntry::getRealName)
191 .filter(s -> s.endsWith(CLASS_EXT))
192 .map(s -> s.substring(s.lastIndexOf('/') + 1)) // trim everything before the last '/'
193 .map(s -> s.substring(0, s.length() - CLASS_EXT.length())) // trim the class extension
194 .collect(Collectors.toSet());
195
196 javaPlugins.removeAll(res);
197
198 assertTrue(javaPlugins.isEmpty(), "All java plugins should be represented in jar " + jar + " but the following were not: " + javaPlugins);
199 }
200 }
201 }
202}

Callers 11

testBonusPluginsMethod · 0.95
testConverterPluginsMethod · 0.95
testFunctionPluginsMethod · 0.95
testGroupingPluginsMethod · 0.95
testLstPluginsMethod · 0.95
testModifierPluginsMethod · 0.95
testPreTokensPluginsMethod · 0.95
testPrimitivePluginsMethod · 0.95
testQualifierPluginsMethod · 0.95

Calls 4

streamMethod · 0.80
lastIndexOfMethod · 0.65
removeAllMethod · 0.65
isEmptyMethod · 0.65

Tested by

no test coverage detected