ModelMapper { public DbLicense getDbLicense(final License license) { final DbLicense dbLicense = new DbLicense(); dbLicense.setName(license.getName()); dbLicense.setLongName(license.getLongName()); dbLicense.setComments(license.getComments()); dbLicense.setRegexp(license.getRegexp()); dbLicense.setUrl(license.getUrl()); return dbLicense; } 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 testGetDbLicense() throws Exception { final License license = DataModelFactory.createLicense("name", "longName", "comments", "regexp", "url"); final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class)); final DbLicense dbLicense = modelMapper.getDbLicense(license); assertEquals(license.getName(), dbLicense.getName()); assertEquals(license.getLongName(), dbLicense.getLongName()); assertEquals(license.getComments(), dbLicense.getComments()); assertEquals(license.getRegexp(), dbLicense.getRegexp()); assertEquals(license.getUrl(), dbLicense.getUrl()); }