RelationshipTrackerConverterService implements TrackerConverterService<Relationship, org.hisp.dhis.relationship.Relationship> { @Override public org.hisp.dhis.relationship.Relationship from( TrackerPreheat preheat, Relationship fromRelationship ) { org.hisp.dhis.relationship.Relationship toRelationship = preheat .getRelationship( TrackerIdScheme.UID, fromRelationship.getRelationship() ); return from( preheat, fromRelationship, toRelationship ); }  @Override Relationship to( org.hisp.dhis.relationship.Relationship relationship ); @Override List<Relationship> to( List<org.hisp.dhis.relationship.Relationship> relationships ); @Override org.hisp.dhis.relationship.Relationship from( TrackerPreheat preheat, Relationship fromRelationship ); @Override List<org.hisp.dhis.relationship.Relationship> from( TrackerPreheat preheat,
        List<Relationship> fromRelationships ); @Override org.hisp.dhis.relationship.Relationship fromForRuleEngine( TrackerPreheat preheat,
        Relationship relationship );  }
@Test public void testConverterFromRelationships() { List<org.hisp.dhis.relationship.Relationship> from = relationshipConverterService .from( trackerBundle.getPreheat(), trackerBundle.getRelationships() ); assertNotNull( from ); assertEquals( 2, from.size() ); org.hisp.dhis.relationship.Relationship relationship1 = from.get( 0 ); assertNotNull( relationship1 ); assertNotNull( relationship1.getFrom() ); assertNotNull( relationship1.getTo() ); assertEquals( MOTHER_TO_CHILD_RELATIONSHIP_TYPE, relationship1.getRelationshipType().getUid() ); assertEquals( MOTHER, relationship1.getFrom().getTrackedEntityInstance().getUid() ); assertEquals( CHILD, relationship1.getTo().getTrackedEntityInstance().getUid() ); org.hisp.dhis.relationship.Relationship relationship2 = from.get( 1 ); assertNotNull( relationship2 ); assertNotNull( relationship2.getFrom() ); assertNotNull( relationship2.getTo() ); assertEquals( CHILD_TO_MOTHER_RELATIONSHIP_TYPE, relationship2.getRelationshipType().getUid() ); assertEquals( CHILD, relationship2.getFrom().getTrackedEntityInstance().getUid() ); assertEquals( MOTHER, relationship2.getTo().getTrackedEntityInstance().getUid() ); }