ModelMapper { public DbArtifact getDbArtifact(final Artifact artifact) { final DbArtifact dbArtifact = new DbArtifact(); dbArtifact.setGroupId(artifact.getGroupId()); dbArtifact.setArtifactId(artifact.getArtifactId()); dbArtifact.setVersion(artifact.getVersion()); dbArtifact.setClassifier(artifact.getClassifier()); dbArtifact.setType(artifact.getType()); dbArtifact.setExtension(artifact.getExtension()); dbArtifact.setOrigin(artifact.getOrigin()); dbArtifact.setPromoted(artifact.isPromoted()); dbArtifact.setLicenses(artifact.getLicenses()); dbArtifact.setSize(artifact.getSize()); dbArtifact.setSha256(artifact.getSha256()); dbArtifact.setDescription(artifact.getDescription()); dbArtifact.setDownloadUrl(artifact.getDownloadUrl()); dbArtifact.setProvider(artifact.getProvider()); dbArtifact.setCreatedDateTime(artifact.getCreatedDateTime()); dbArtifact.setUpdatedDateTime(artifact.getUpdatedDateTime()); return dbArtifact; } 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 testGetDbArtifact(){ final Artifact artifact = DataModelFactory.createArtifact("groupId", "artifactId", "version", "classifier", "type", "extension"); artifact.setSize("10Mo"); artifact.setDownloadUrl("http: artifact.setProvider("http: final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class)); final DbArtifact dbArtifact = modelMapper.getDbArtifact(artifact); assertEquals(artifact.getGroupId(), dbArtifact.getGroupId()); assertEquals(artifact.getArtifactId(), dbArtifact.getArtifactId()); assertEquals(artifact.getVersion(), dbArtifact.getVersion()); assertEquals(artifact.getClassifier(), dbArtifact.getClassifier()); assertEquals(artifact.getType(), dbArtifact.getType()); assertEquals(artifact.getExtension(), dbArtifact.getExtension()); assertEquals(artifact.getSize(), dbArtifact.getSize()); assertEquals(artifact.getDownloadUrl(), dbArtifact.getDownloadUrl()); assertEquals(artifact.getProvider(), dbArtifact.getProvider()); }