@Test void disallowsNull() { assertThatThrownBy(() -> toComponent(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Artifact must not be null"); }
public static Component toComponent(Artifact artifact) { if (artifact == null) { throw new IllegalArgumentException("Artifact must not be null"); } Component c = new Component(); c.setType(Component.Type.LIBRARY); setCoordinatesForComponent(artifact, c); LicenseInformation licenses = ArtifactLicenseUtils.getFinalLicenses(artifact); addLicensesToComponent(licenses.getLicenses(), c); addHashesToComponent(artifact, c); if (c.getPurl() == null) { createGenericPurl(c, artifact); } return c; }
ArtifactToComponentConverter { public static Component toComponent(Artifact artifact) { if (artifact == null) { throw new IllegalArgumentException("Artifact must not be null"); } Component c = new Component(); c.setType(Component.Type.LIBRARY); setCoordinatesForComponent(artifact, c); LicenseInformation licenses = ArtifactLicenseUtils.getFinalLicenses(artifact); addLicensesToComponent(licenses.getLicenses(), c); addHashesToComponent(artifact, c); if (c.getPurl() == null) { createGenericPurl(c, artifact); } return c; } }
ArtifactToComponentConverter { public static Component toComponent(Artifact artifact) { if (artifact == null) { throw new IllegalArgumentException("Artifact must not be null"); } Component c = new Component(); c.setType(Component.Type.LIBRARY); setCoordinatesForComponent(artifact, c); LicenseInformation licenses = ArtifactLicenseUtils.getFinalLicenses(artifact); addLicensesToComponent(licenses.getLicenses(), c); addHashesToComponent(artifact, c); if (c.getPurl() == null) { createGenericPurl(c, artifact); } return c; } private  ArtifactToComponentConverter(); }
ArtifactToComponentConverter { public static Component toComponent(Artifact artifact) { if (artifact == null) { throw new IllegalArgumentException("Artifact must not be null"); } Component c = new Component(); c.setType(Component.Type.LIBRARY); setCoordinatesForComponent(artifact, c); LicenseInformation licenses = ArtifactLicenseUtils.getFinalLicenses(artifact); addLicensesToComponent(licenses.getLicenses(), c); addHashesToComponent(artifact, c); if (c.getPurl() == null) { createGenericPurl(c, artifact); } return c; } private  ArtifactToComponentConverter(); static Component toComponent(Artifact artifact); }
ArtifactToComponentConverter { public static Component toComponent(Artifact artifact) { if (artifact == null) { throw new IllegalArgumentException("Artifact must not be null"); } Component c = new Component(); c.setType(Component.Type.LIBRARY); setCoordinatesForComponent(artifact, c); LicenseInformation licenses = ArtifactLicenseUtils.getFinalLicenses(artifact); addLicensesToComponent(licenses.getLicenses(), c); addHashesToComponent(artifact, c); if (c.getPurl() == null) { createGenericPurl(c, artifact); } return c; } private  ArtifactToComponentConverter(); static Component toComponent(Artifact artifact);  }