AffMatchResultConverter implements Serializable { public MatchedOrganization convert(AffMatchResult affMatchResult) { Preconditions.checkNotNull(affMatchResult); MatchedOrganization matchedOrganization = new MatchedOrganization(); matchedOrganization.setDocumentId(affMatchResult.getAffiliation().getDocumentId()); matchedOrganization.setOrganizationId(affMatchResult.getOrganization().getId()); matchedOrganization.setMatchStrength(affMatchResult.getMatchStrength()); return matchedOrganization; }  MatchedOrganization convert(AffMatchResult affMatchResult);  }
@Test(expected = NullPointerException.class) public void convert_null() { converter.convert(null); }
@Test public void convert() { AffMatchAffiliation aff = new AffMatchAffiliation("DOC1", 1); AffMatchOrganization org = new AffMatchOrganization("ORG1"); AffMatchResult affMatchResult = new AffMatchResult(aff, org, 0.85f); MatchedOrganization matchedOrg = converter.convert(affMatchResult); assertNotNull(matchedOrg); assertEquals("DOC1", matchedOrg.getDocumentId()); assertEquals("ORG1", matchedOrg.getOrganizationId()); assertEquals(0.85f, matchedOrg.getMatchStrength().floatValue(), 0.002); }