ModelMapper { public DbComment getDbComment(final Comment comment) { final DbComment dbComment = new DbComment(); dbComment.setEntityId(comment.getEntityId()); dbComment.setEntityType(comment.getEntityType()); dbComment.setAction(comment.getAction()); dbComment.setDbCommentText(comment.getCommentText()); dbComment.setDbCommentedBy(comment.getCommentedBy()); dbComment.setDbCreatedDateTime(comment.getCreatedDateTime()); return dbComment; } 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 getDbCommentFromComment() throws Exception { final String entityId = "com.axway.test:1.0.0::jar"; final String entityType = "DbArtifact"; final Comment comment = DataModelFactory.createComment(entityId, entityType, "test action","test comment", "testUser", new Date()); final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class)); final DbComment dbComment = modelMapper.getDbComment(comment); assertEquals(entityId, dbComment.getEntityId()); assertEquals(entityType, dbComment.getEntityType()); assertEquals("test comment", dbComment.getDbCommentText()); assertEquals("test action", dbComment.getAction()); assertEquals("testUser", dbComment.getDbCommentedBy()); }