DocumentProjectConverter implements Serializable { public AffMatchDocumentProject convert(DocumentToProject documentProject) { Preconditions.checkNotNull(documentProject); Preconditions.checkArgument(StringUtils.isNotBlank(documentProject.getDocumentId())); Preconditions.checkArgument(StringUtils.isNotBlank(documentProject.getProjectId())); return new AffMatchDocumentProject(documentProject.getDocumentId().toString() , documentProject.getProjectId().toString(), 1f); }  AffMatchDocumentProject convert(DocumentToProject documentProject);  }
@Test(expected = NullPointerException.class) public void convert_NULL_DOC_PROJ() { converter.convert(null); }
@Test(expected = IllegalArgumentException.class) public void convert_NULL_DOC_ID() { converter.convert(new DocumentToProject(null, projectId)); }
@Test(expected = IllegalArgumentException.class) public void convert_BLANK_DOC_ID() { converter.convert(new DocumentToProject(" ", projectId)); }
@Test(expected = IllegalArgumentException.class) public void convert_NULL_ORG_ID() { converter.convert(new DocumentToProject(documentId, null)); }
@Test(expected = IllegalArgumentException.class) public void convert_BLANK_ORG_ID() { converter.convert(new DocumentToProject(documentId, " ")); }
@Test public void convert() { DocumentToProject documentProject = new DocumentToProject(documentId, projectId); AffMatchDocumentProject retAffMatchDocProj = converter.convert(documentProject); assertEquals(new AffMatchDocumentProject(documentId, projectId, 1f), retAffMatchDocProj); }