ModelMapper { public DbOrganization getDbOrganization(final Organization organization) { final DbOrganization dbOrganization = new DbOrganization(); dbOrganization.setName(organization.getName()); dbOrganization.getCorporateGroupIdPrefixes().addAll(organization.getCorporateGroupIdPrefixes()); return dbOrganization; } 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 getDbOrganizationFromOrganization(){ final Organization organization = DataModelFactory.createOrganization("test"); organization.getCorporateGroupIdPrefixes().add("com.test"); final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class)); final DbOrganization dbOrganization = modelMapper.getDbOrganization(organization); assertEquals(organization.getName(), dbOrganization.getName()); assertEquals(1, dbOrganization.getCorporateGroupIdPrefixes().size()); assertEquals(organization.getCorporateGroupIdPrefixes().get(0), dbOrganization.getCorporateGroupIdPrefixes().get(0)); }