LicenseNameWithTextUtils { public static boolean licenseNameWithTextEquals(LicenseNameWithText lnwt1, LicenseNameWithText lnwt2) { return nullToEmpty(lnwt1.getLicenseName()).trim().equals(nullToEmpty(lnwt2.getLicenseName()).trim()) && nullToEmpty(lnwt1.getLicenseText()).trim().equals(nullToEmpty(lnwt2.getLicenseText()).trim()) && nullToEmpty(lnwt1.getAcknowledgements()).trim().equals(nullToEmpty(lnwt2.getAcknowledgements()).trim()); }  static LicenseNameWithText sanitize(LicenseNameWithText licenseNameWithText); static boolean isEmpty(LicenseNameWithText licenseNameWithText); static boolean licenseNameWithTextEquals(LicenseNameWithText lnwt1, LicenseNameWithText lnwt2);  }
@Test public void testLicenseNameWithTextEquals() { Assert.assertTrue(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense(null, null, null), createLicense(null, null, null))); Assert.assertTrue(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense(" ", "", "\t"), createLicense(null, null, null))); Assert.assertTrue(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense("name", " ", null), createLicense("name", null, null))); Assert.assertTrue(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense(null, "text", "\n"), createLicense(null, "text", null))); Assert.assertTrue(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense(null, null, "ack"), createLicense(null, null, "ack"))); Assert.assertFalse(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense(null, null, null), createLicense("name", null, null))); Assert.assertFalse(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense(null, null, null), createLicense(null, "text", null))); Assert.assertFalse(LicenseNameWithTextUtils.licenseNameWithTextEquals( createLicense(null, null, null), createLicense(null, null, "ack"))); }