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