AffMatchOrganizationNormalizer implements Serializable { public AffMatchOrganization normalize(AffMatchOrganization affMatchOrganization) { Preconditions.checkNotNull(affMatchOrganization); AffMatchOrganization normalizedOrganization = new AffMatchOrganization(affMatchOrganization.getId()); normalizedOrganization.setName(organizationNameNormalizer.normalize(affMatchOrganization.getName())); normalizedOrganization.setShortName(organizationShortNameNormalizer.normalize(affMatchOrganization.getShortName())); normalizedOrganization.setCountryName(countryNameNormalizer.normalize(affMatchOrganization.getCountryName())); normalizedOrganization.setCountryCode(countryCodeNormalizer.normalize(affMatchOrganization.getCountryCode())); normalizedOrganization.setWebsiteUrl(websiteUrlNormalizer.normalize(affMatchOrganization.getWebsiteUrl())); return normalizedOrganization; }  AffMatchOrganization normalize(AffMatchOrganization affMatchOrganization); void setOrganizationNameNormalizer(StringNormalizer organizationNameNormalizer); void setOrganizationShortNameNormalizer(StringNormalizer organizationShortNameNormalizer); void setCountryNameNormalizer(StringNormalizer countryNameNormalizer); void setCountryCodeNormalizer(StringNormalizer countryCodeNormalizer); void setWebsiteUrlNormalizer(StringNormalizer websiteUrlNormalizer);  }
@Test(expected = NullPointerException.class) public void normalize_null() { normalizer.normalize(null); }
@Test public void normalize() { AffMatchOrganization org = new AffMatchOrganization("XXX"); org.setName("ICM_LONG"); org.setShortName("ICM"); org.setCountryCode("PL"); org.setCountryName("Poland"); org.setWebsiteUrl("www.icm.edu.pl"); when(organizationNameNormalizer.normalize("ICM_LONG")).thenReturn("icm long"); when(organizationShortNameNormalizer.normalize("ICM")).thenReturn("icm"); when(countryCodeNormalizer.normalize("PL")).thenReturn("pl"); when(countryNameNormalizer.normalize("Poland")).thenReturn("poland"); when(websiteUrlNormalizer.normalize("www.icm.edu.pl")).thenReturn("icm.edu.pl"); AffMatchOrganization normalizedOrg = normalizer.normalize(org); assertTrue(org != normalizedOrg); assertEquals("XXX", normalizedOrg.getId()); assertEquals("icm long", normalizedOrg.getName()); assertEquals("icm", normalizedOrg.getShortName()); assertEquals("pl", normalizedOrg.getCountryCode()); assertEquals("poland", normalizedOrg.getCountryName()); assertEquals("icm.edu.pl", normalizedOrg.getWebsiteUrl()); }