ArtifactAdapter implements ArtifactAndLicense { public static String createKey(License license) { int hashCode = license.getId().hashCode(); String prefix = hashCode < 0 ? "n" : "p"; return prefix + Math.abs(hashCode); } ArtifactAdapter(Artifact artifact); static String getLicenseText(License license); static String createKey(License license); @Override String getFilename(); @Override List<LicenseInfo> getLicenses(); @Override Optional<String> getCopyrightStatement(); @Override Optional<String> getPurl();  }
@Test void generateKey() { License license = new License(); license.setId("ASL2.0"); String key = ArtifactAdapter.createKey(license); assertThat(key).isEqualTo("p1939860698"); }