@Test
public void testThatLicensesAreFilteredAndOriginalObejctIsNotTouched() {

    LicenseInfoParsingResult parsingResults = new LicenseInfoParsingResult();
    LicenseInfo licenseInfo = new LicenseInfo();
    // @formatter:off
    licenseInfo.setLicenseNamesWithTexts(ImmutableSet.of(
            createLicense("l1", null, null),
            createLicense("l1", "t1", null),
            createLicense("l2", "t2", null),
            createLicense("l3", "t3", null),
            createLicense("l3", "t3", "a3"),
            createLicense(null, "t4", null),
            createLicense("l4", "t4", null),
            createLicense(null, null, "a5"),
            createLicense("l5", null, "a5"),
            createLicense("l", "t", "a6"),
            createLicense("l", "t", "a7"),
            createLicense("l8", null, null),
            createLicense("l8", "t8", null),
            createLicense("l9", "t9", "a9"),
            createLicense(null, "t9", "a9")
    ));
    // @formatter:on
    parsingResults.setLicenseInfo(licenseInfo);
    // @formatter:off
    LicenseInfoParsingResult filteredResult = handler.filterLicenses(parsingResults, ImmutableSet.of(
            createLicense("l1", "t1", null),
            createLicense("l3", "t3", "a3"),
            createLicense(null, "t4", null),
            createLicense(null, null, "a5"),
            createLicense("l", "t", "a6"),
            createLicense("l8", null, null),
            createLicense(null, "t9", "a9")
    ));
    // @formatter:on
    // @formatter:off
    Assert.assertThat(filteredResult.getLicenseInfo().getLicenseNamesWithTexts(), Matchers.containsInAnyOrder(
            createLicense("l1", null, null),
            createLicense("l2", "t2", null),
            createLicense("l3", "t3", null),
            createLicense("l4", "t4", null),
            createLicense("l5", null, "a5"),
            createLicense("l", "t", "a7"),
            createLicense("l8", "t8", null),
            createLicense("l9", "t9", "a9")
    ));
    // @formatter:on
}