@Test(dataProvider = "readPackageInfoProvider") public void readPackageInfoTest(String name, String version, String expectedScope, String expectedName, String expectedVersion) { ObjectMapper objectMapper = new ObjectMapper(); NpmPackageInfo inputPackageInfo = new NpmPackageInfo(name, version, ""); try (InputStream is = new ByteArrayInputStream(objectMapper.writeValueAsBytes(inputPackageInfo))) { NpmPackageInfo npmPackageInfo = new NpmPackageInfo(); npmPackageInfo.readPackageInfo(is); assertEquals(npmPackageInfo.getScope(), expectedScope); assertEquals(npmPackageInfo.getName(), expectedName); assertEquals(npmPackageInfo.getVersion(), expectedVersion); } catch (IOException e) { fail(ExceptionUtils.getRootCauseMessage(e), e); } }
public void readPackageInfo(InputStream inputStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); NpmPackageInfo npmPackageInfo = mapper.readValue(inputStream, NpmPackageInfo.class); setVersion(npmPackageInfo.getVersion()); removeVersionPrefixes(); setName(npmPackageInfo.getName()); splitScopeFromName(); }
NpmPackageInfo implements Serializable, ProducerConsumerItem { public void readPackageInfo(InputStream inputStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); NpmPackageInfo npmPackageInfo = mapper.readValue(inputStream, NpmPackageInfo.class); setVersion(npmPackageInfo.getVersion()); removeVersionPrefixes(); setName(npmPackageInfo.getName()); splitScopeFromName(); } }
NpmPackageInfo implements Serializable, ProducerConsumerItem { public void readPackageInfo(InputStream inputStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); NpmPackageInfo npmPackageInfo = mapper.readValue(inputStream, NpmPackageInfo.class); setVersion(npmPackageInfo.getVersion()); removeVersionPrefixes(); setName(npmPackageInfo.getName()); splitScopeFromName(); } @SuppressWarnings("unused")  NpmPackageInfo();  NpmPackageInfo(String name, String version, String scope); }
NpmPackageInfo implements Serializable, ProducerConsumerItem { public void readPackageInfo(InputStream inputStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); NpmPackageInfo npmPackageInfo = mapper.readValue(inputStream, NpmPackageInfo.class); setVersion(npmPackageInfo.getVersion()); removeVersionPrefixes(); setName(npmPackageInfo.getName()); splitScopeFromName(); } @SuppressWarnings("unused")  NpmPackageInfo();  NpmPackageInfo(String name, String version, String scope); String getName(); void setName(String name); String getVersion(); void setVersion(String version); String getScope(); void setScope(String scope); void readPackageInfo(InputStream inputStream); String getModuleId(); String getExpectedPackedFileName(); String getDeployPath(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
NpmPackageInfo implements Serializable, ProducerConsumerItem { public void readPackageInfo(InputStream inputStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); NpmPackageInfo npmPackageInfo = mapper.readValue(inputStream, NpmPackageInfo.class); setVersion(npmPackageInfo.getVersion()); removeVersionPrefixes(); setName(npmPackageInfo.getName()); splitScopeFromName(); } @SuppressWarnings("unused")  NpmPackageInfo();  NpmPackageInfo(String name, String version, String scope); String getName(); void setName(String name); String getVersion(); void setVersion(String version); String getScope(); void setScope(String scope); void readPackageInfo(InputStream inputStream); String getModuleId(); String getExpectedPackedFileName(); String getDeployPath(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }