LicenseHandler implements LicenseMatcher { public List<License> getLicenses() { final ModelMapper modelMapper = new ModelMapper(repoHandler); final List<License> licenses = new ArrayList<>(); for (final DbLicense dbLicense : licensesRegexp.values()) { licenses.add(modelMapper.getLicense(dbLicense)); } return licenses; } LicenseHandler(final RepositoryHandler repoHandler); void store(final DbLicense dbLicense); List<String> getLicensesNames(final FiltersHolder filters); DbLicense getLicense(final String name); void deleteLicense(final String licName); void approveLicense(final String name, final Boolean approved); DbLicense resolve(final String licenseId); List<License> getLicenses(); Set<DbLicense> resolveLicenses(List<String> licStrings); @Override Set<DbLicense> getMatchingLicenses(String licenseString);  }
@Test public void getAllTheAvailableLicenses(){ final DbLicense license = new DbLicense(); license.setName("Test"); final RepositoryHandler repoHandler = mock(RepositoryHandler.class); when(repoHandler.getAllLicenses()).thenReturn(Collections.singletonList(license)); final LicenseHandler licenseHandler = new LicenseHandler(repoHandler); assertEquals(1, licenseHandler.getLicenses().size()); }