### Question:
E2ERelationshipPersistence { public static E2ERelationship toData(final CdmE2ERelationship instance) { final E2ERelationship e2ERelationship = new E2ERelationship(); if (!StringUtils.isNullOrTrimEmpty(instance.getName())) { e2ERelationship.setName(instance.getName()); } e2ERelationship.setFromEntity(instance.getFromEntity()); e2ERelationship.setFromEntityAttribute(instance.getFromEntityAttribute()); e2ERelationship.setToEntity(instance.getToEntity()); e2ERelationship.setToEntityAttribute(instance.getToEntityAttribute()); return e2ERelationship; }  static CdmE2ERelationship fromData(final CdmCorpusContext ctx, final E2ERelationship dataObj); static E2ERelationship toData(final CdmE2ERelationship instance);  }### Answer:
@Test public void toDataTest() { CdmCorpusDefinition corpus = new CdmCorpusDefinition(); CdmE2ERelationship instance = corpus.makeObject(CdmObjectType.E2ERelationshipDef); instance.setToEntity("TO_ENTITY"); instance.setToEntityAttribute("TO_ENTITY_ATTRIBUTE"); instance.setFromEntity("FROM_ENTITY"); instance.setFromEntityAttribute("FROM_ENTITY_ATTRIBUTE"); E2ERelationship result = E2ERelationshipPersistence.toData(instance); AssertJUnit.assertEquals(result.getToEntity(), "TO_ENTITY"); AssertJUnit.assertEquals(result.getToEntityAttribute(), "TO_ENTITY_ATTRIBUTE"); AssertJUnit.assertEquals(result.getFromEntity(), "FROM_ENTITY"); AssertJUnit.assertEquals(result.getFromEntityAttribute(), "FROM_ENTITY_ATTRIBUTE"); }