@Test public void hash() { when(getOrgNamesFunction.apply(organization)).thenReturn(Lists.newArrayList("ICM", "PWR")); when(stringHasher.hash("ICM")).thenReturn("HASH"); String hash = hasher.hash(organization); assertEquals("HASH", hash); }
@Override public String hash(AffMatchOrganization organization) { Preconditions.checkNotNull(organization); List<String> orgNames = getOrgNamesFunction.apply(organization); if (CollectionUtils.isEmpty(orgNames)) { return null; } return stringHasher.hash(orgNames.get(0)); }
OrganizationNameBucketHasher implements BucketHasher<AffMatchOrganization> { @Override public String hash(AffMatchOrganization organization) { Preconditions.checkNotNull(organization); List<String> orgNames = getOrgNamesFunction.apply(organization); if (CollectionUtils.isEmpty(orgNames)) { return null; } return stringHasher.hash(orgNames.get(0)); } }
OrganizationNameBucketHasher implements BucketHasher<AffMatchOrganization> { @Override public String hash(AffMatchOrganization organization) { Preconditions.checkNotNull(organization); List<String> orgNames = getOrgNamesFunction.apply(organization); if (CollectionUtils.isEmpty(orgNames)) { return null; } return stringHasher.hash(orgNames.get(0)); }  }
OrganizationNameBucketHasher implements BucketHasher<AffMatchOrganization> { @Override public String hash(AffMatchOrganization organization) { Preconditions.checkNotNull(organization); List<String> orgNames = getOrgNamesFunction.apply(organization); if (CollectionUtils.isEmpty(orgNames)) { return null; } return stringHasher.hash(orgNames.get(0)); }  @Override String hash(AffMatchOrganization organization); void setStringHasher(BucketHasher<String> stringHasher); void setGetOrgNamesFunction(Function<AffMatchOrganization, List<String>> getOrgNamesFunction); }
OrganizationNameBucketHasher implements BucketHasher<AffMatchOrganization> { @Override public String hash(AffMatchOrganization organization) { Preconditions.checkNotNull(organization); List<String> orgNames = getOrgNamesFunction.apply(organization); if (CollectionUtils.isEmpty(orgNames)) { return null; } return stringHasher.hash(orgNames.get(0)); }  @Override String hash(AffMatchOrganization organization); void setStringHasher(BucketHasher<String> stringHasher); void setGetOrgNamesFunction(Function<AffMatchOrganization, List<String>> getOrgNamesFunction);  }