ModelMapper { public Comment getComment(final DbComment dbComment) { return DataModelFactory.createComment(dbComment.getEntityId(), dbComment.getEntityType(), dbComment.getAction(), dbComment.getDbCommentText(), dbComment.getDbCommentedBy(), dbComment.getDbCreatedDateTime()); } ModelMapper(final RepositoryHandler repoHandler); DbOrganization getDbOrganization(final Organization organization); Organization getOrganization(final DbOrganization dbOrganization); DbLicense getDbLicense(final License license); License getLicense(final DbLicense dbLicense); DbArtifact getDbArtifact(final Artifact artifact); Artifact getArtifact(final DbArtifact dbArtifact); DbModule getDbModule(final Module module); Module getModule(final DbModule dbModule); Dependency getDependency(final DbDependency dbDependency, final String sourceName, final String sourceVersion); Comment getComment(final DbComment dbComment); DbComment getDbComment(final Comment comment);  }
@Test public void getCommentFromDbComment() throws Exception { final String entityId = "com.axway.test:1.0.0::jar"; final String entityType = "DbArtifact"; DbComment dbComment = new DbComment(); dbComment.setEntityId(entityId); dbComment.setEntityType(entityType); dbComment.setDbCommentText("test comment"); dbComment.setDbCommentedBy("testUser"); dbComment.setDbCreatedDateTime(new Date()); final RepositoryHandler repositoryHandler = mock(RepositoryHandler.class); final ModelMapper modelMapper = new ModelMapper(repositoryHandler); final Comment comment = modelMapper.getComment(dbComment); assertEquals(entityId, comment.getEntityId()); assertEquals(entityType, comment.getEntityType()); assertEquals("test comment", comment.getCommentText()); assertEquals("testUser", comment.getCommentedBy()); }