@Test public void testGetLicenseDetailsException() { SW360SparseLicense license = new SW360SparseLicense().setShortName("foo"); when(licenseClientAdapter.enrichSparseLicense(license)) .thenThrow(new SW360ClientException("License lookup failed")); setUp(); Optional<SW360License> licenseDetails = metaDataReceiver.getLicenseDetails(license); assertThat(licenseDetails).isEmpty(); }
public Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense) { try { return Optional.of(licenseClientAdapter.enrichSparseLicense(sparseLicense)); } catch (SW360ClientException e) { LOGGER.debug("Failed to lookup sparse license {}.", sparseLicense.getShortName(), e); return Optional.empty(); } }
SW360MetaDataReceiver { public Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense) { try { return Optional.of(licenseClientAdapter.enrichSparseLicense(sparseLicense)); } catch (SW360ClientException e) { LOGGER.debug("Failed to lookup sparse license {}.", sparseLicense.getShortName(), e); return Optional.empty(); } } }
SW360MetaDataReceiver { public Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense) { try { return Optional.of(licenseClientAdapter.enrichSparseLicense(sparseLicense)); } catch (SW360ClientException e) { LOGGER.debug("Failed to lookup sparse license {}.", sparseLicense.getShortName(), e); return Optional.empty(); } } SW360MetaDataReceiver(SW360Connection sw360ConnectionConfiguration); }
SW360MetaDataReceiver { public Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense) { try { return Optional.of(licenseClientAdapter.enrichSparseLicense(sparseLicense)); } catch (SW360ClientException e) { LOGGER.debug("Failed to lookup sparse license {}.", sparseLicense.getShortName(), e); return Optional.empty(); } } SW360MetaDataReceiver(SW360Connection sw360ConnectionConfiguration); Optional<SW360Release> findReleaseForArtifact(Artifact artifact); Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense); Optional<Path> downloadAttachment(SW360Release release, SW360SparseAttachment attachment, Path downloadPath); }
SW360MetaDataReceiver { public Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense) { try { return Optional.of(licenseClientAdapter.enrichSparseLicense(sparseLicense)); } catch (SW360ClientException e) { LOGGER.debug("Failed to lookup sparse license {}.", sparseLicense.getShortName(), e); return Optional.empty(); } } SW360MetaDataReceiver(SW360Connection sw360ConnectionConfiguration); Optional<SW360Release> findReleaseForArtifact(Artifact artifact); Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense); Optional<Path> downloadAttachment(SW360Release release, SW360SparseAttachment attachment, Path downloadPath);  }