NpmAnalyzerPlugin implements AnalyzerPlugin { protected NpmModule getNpmModule(InputStream inputStream) throws Exception { JSONCodec jsonCodec = new JSONCodec(); Decoder decoder = jsonCodec.dec(); decoder = decoder.from(inputStream); return decoder.get(NpmModule.class); }  @Override boolean analyzeJar(Analyzer analyzer); static final String WEB_CONTEXT_PATH; }
@Test public void testConversion() throws Exception { NpmAnalyzerPlugin npmAnalyzerPlugin = new NpmAnalyzerPlugin(); URL url = getResource("dependencies/package.json"); NpmAnalyzerPlugin.NpmModule npmModule = npmAnalyzerPlugin.getNpmModule( url.openStream()); Assert.assertNotNull(npmModule); Assert.assertEquals("liferay", npmModule.name); Assert.assertEquals("1.2.4", npmModule.version); Assert.assertTrue(npmModule.dependencies.containsKey("lodash")); Assert.assertEquals("~3.9.3", npmModule.dependencies.get("lodash")); }