ArtifactAdapter implements ArtifactAndLicense { public static String getLicenseText(License license) { String text = license.getText(); if (StringUtils.isBlank(text)) { return "No license text available"; } return text .replace("\u0009", " ") .replace("\u00a0", " ") .replace("\u200b", "") .replace("\u2028", "\n") .replace("\ufeff", ""); } 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 licenseWithNullTextTest() { License license = new License(); license.setText(null); String licenseText = ArtifactAdapter.getLicenseText(license); assertThat(licenseText).isEqualTo("No license text available"); }
@Test void basicLicenseTest() { License license = new License(); license.setText("Lorum ipsum"); String licenseText = ArtifactAdapter.getLicenseText(license); assertThat(licenseText).isEqualTo("Lorum ipsum"); }
@Test void removeSpecialUTFfromText() { License license = new License(); license.setText("\uFEFFLorum ipsum"); String licenseText = ArtifactAdapter.getLicenseText(license); assertThat(licenseText).isEqualTo("Lorum ipsum"); }