@Test
public void testGetLicensesWithExistingLicense() {

    final String licenseName = "licenseName";
    List<SW360SparseLicense> testLicenses = createTestLicenses();
    testLicenses.add(createLicense(licenseName));
    final SW360License license = new SW360License()
            .setShortName(licenseName);
    License licenseAntenna = new License();
    licenseAntenna.setId(licenseName);
    when(licenseClientAdapter.getLicenses()).thenReturn(testLicenses);
    when(licenseClientAdapter.getLicenseByName(licenseName))
            .thenReturn(Optional.of(license));
    final Set<SW360License> licenses = metaDataUpdater.getLicenses(Collections.singletonList(licenseAntenna));
    assertThat(licenses).hasSize(1);
    verify(licenseClientAdapter, times(1)).getLicenses();
    verify(licenseClientAdapter, times(1)).getLicenseByName(licenseName);
}