### Question:
LicenseInfoHandler implements LicenseInfoService.Iface { protected void filterEmptyLicenses(List<LicenseInfoParsingResult> results) { for (LicenseInfoParsingResult result : results) { if (result.isSetLicenseInfo() && result.getLicenseInfo().isSetLicenseNamesWithTexts()) { result.getLicenseInfo().setLicenseNamesWithTexts( result.getLicenseInfo().getLicenseNamesWithTexts().stream().filter(licenseNameWithText -> { return !LicenseNameWithTextUtils.isEmpty(licenseNameWithText); }).collect(Collectors.toSet())); } } } LicenseInfoHandler(); @VisibleForTesting protected  LicenseInfoHandler(AttachmentDatabaseHandler attachmentDatabaseHandler,
                              ComponentDatabaseHandler componentDatabaseHandler, ProjectDatabaseHandler projectDatabaseHandler); @Override LicenseInfoFile getLicenseInfoFile(Project project, User user, String outputGenerator,
                                              Map<String, Set<String>> releaseIdsToSelectedAttachmentIds, Map<String, Set<LicenseNameWithText>> excludedLicensesPerAttachment, String externalIds); @Override List<OutputFormatInfo> getPossibleOutputFormats(); @Override OutputFormatInfo getOutputFormatInfoForGeneratorClass(String generatorClassName); @Override List<LicenseInfoParsingResult> getLicenseInfoForAttachment(Release release, String attachmentContentId, User user); @Override LicenseObligationsStatusInfo getProjectObligationStatus(Map<String, ObligationStatusInfo> obligationStatusMap, List<LicenseInfoParsingResult> licenseResults, 
            Map<String, String> excludedReleaseIdToAcceptedCLI); @Override LicenseInfoParsingResult createLicenseToObligationMapping(LicenseInfoParsingResult licenseResult, ObligationParsingResult obligationResult); @Override List<ObligationParsingResult> getObligationsForAttachment(Release release, String attachmentContentId, User user); @Override String getDefaultLicenseInfoHeaderText(); @Override String getDefaultObligationsText();  }### Answer:
@Test public void testThatEmptyLicensesAreFiltered() { LicenseInfoParsingResult emptyResult = new LicenseInfoParsingResult(); LicenseInfoParsingResult emptyLicenseInfo = new LicenseInfoParsingResult(); emptyLicenseInfo.setLicenseInfo(new LicenseInfo()); LicenseInfoParsingResult parsingResults = new LicenseInfoParsingResult(); LicenseInfo licenseInfo = new LicenseInfo(); licenseInfo.setLicenseNamesWithTexts(ImmutableSet.of( createLicense("nameOnly", null, null), createLicense(null, null, null), createLicense(null, "textOnly", null), createLicense("", null, null), createLicense(null, null, "ackOnly"), createLicense("", "", ""), createLicense("name", "text", "ack") )); parsingResults.setLicenseInfo(licenseInfo); handler.filterEmptyLicenses(ImmutableList.of(emptyResult, emptyLicenseInfo, parsingResults)); Assert.assertThat(parsingResults.getLicenseInfo().getLicenseNamesWithTexts(), Matchers.containsInAnyOrder( createLicense("nameOnly", null, null), createLicense(null, "textOnly", null), createLicense(null, null, "ackOnly"), createLicense("name", "text", "ack") )); }