@Test
  public void testRoundTrip() throws Exception {
    RegistryPackageWebConverter rpwConverter = new RegistryPackageWebConverter();

    RegistryPackageType testRegistryPackage = getTestRegistryPackage();
    Map<String, Object> testRegistryPackageMap = rpwConverter.convert(testRegistryPackage);

    RegistryPackageTypeConverter rptConverter = new RegistryPackageTypeConverter();

    Optional<RegistryPackageType> optionalRegistryPackage =
        rptConverter.convert(testRegistryPackageMap);
    RegistryPackageType convertedTestRegistryPackage = optionalRegistryPackage.get();

    assertThat(
        testRegistryPackage.getObjectType(),
        is(equalTo(convertedTestRegistryPackage.getObjectType())));
    assertThat(testRegistryPackage.getId(), is(equalTo(convertedTestRegistryPackage.getId())));
    assertThat(testRegistryPackage.getHome(), is(equalTo(convertedTestRegistryPackage.getHome())));
    assertThat(
        testRegistryPackage.getExternalIdentifier(),
        is(equalTo(convertedTestRegistryPackage.getExternalIdentifier())));
    assertThat(
        (testRegistryPackage).getRegistryObjectList().getIdentifiable().size(),
        is(
            equalTo(
                (convertedTestRegistryPackage).getRegistryObjectList().getIdentifiable().size())));

    assertThat(testRegistryPackage, is(equalTo(convertedTestRegistryPackage)));
  }
  private RegistryPackageType getTestRegistryPackage() {
    RegistryPackageType registryPackage = RIM_FACTORY.createRegistryPackageType();
    registryPackage.setId("urn:uuid:2014ca7f59ac46f495e32b4a67a51276");
    registryPackage.setHome("https://somehost:someport");
    registryPackage.setObjectType("urn:registry:federation:node");

    registryPackage.getExternalIdentifier().add(getFirstExternalIdentifier());
    registryPackage.getExternalIdentifier().add(getSecondExternalIdentifier());

    RegistryObjectListType registryObjectList = RIM_FACTORY.createRegistryObjectListType();
    registryObjectList
        .getIdentifiable()
        .add(RIM_FACTORY.createExtrinsicObject(getFirstExtrinsicObject()));
    registryObjectList
        .getIdentifiable()
        .add(RIM_FACTORY.createExtrinsicObject(getSecondExtrinsicObject()));
    registryObjectList
        .getIdentifiable()
        .add(RIM_FACTORY.createExtrinsicObject(getThirdExtrinsicObject()));
    registryObjectList
        .getIdentifiable()
        .add(RIM_FACTORY.createExtrinsicObject(getFourthExtrinsicObject()));

    registryObjectList.getIdentifiable().add(RIM_FACTORY.createService(getService()));

    registryObjectList
        .getIdentifiable()
        .add(RIM_FACTORY.createOrganization(getFirstOrganization()));
    registryObjectList
        .getIdentifiable()
        .add(RIM_FACTORY.createOrganization(getSecondOrganization()));

    registryObjectList.getIdentifiable().add(RIM_FACTORY.createPerson(getFirstPerson()));
    registryObjectList.getIdentifiable().add(RIM_FACTORY.createPerson(getSecondPerson()));
    registryObjectList.getIdentifiable().add(RIM_FACTORY.createPerson(getThirdPerson()));

    registryObjectList.getIdentifiable().add(RIM_FACTORY.createAssociation(getFirstAssociation()));
    registryObjectList.getIdentifiable().add(RIM_FACTORY.createAssociation(getSecondAssociation()));
    registryObjectList.getIdentifiable().add(RIM_FACTORY.createAssociation(getThirdAssociation()));
    registryObjectList.getIdentifiable().add(RIM_FACTORY.createAssociation(getFourthAssociation()));
    registryObjectList.getIdentifiable().add(RIM_FACTORY.createAssociation(getFifthAssociation()));
    registryObjectList.getIdentifiable().add(RIM_FACTORY.createAssociation(getSixthAssociation()));

    registryPackage.setRegistryObjectList(registryObjectList);

    return registryPackage;
  }