ProjectToOrganizationRelationConverter implements OafRelToAvroConverter<ProjectToOrganization> { @Override public ProjectToOrganization convert(Relation relation) { Preconditions.checkNotNull(relation); ProjectToOrganization.Builder builder = ProjectToOrganization.newBuilder(); builder.setProjectId(relation.getSource()); builder.setOrganizationId(relation.getTarget()); return builder.build(); }  @Override ProjectToOrganization convert(Relation relation);  }
@Test(expected = NullPointerException.class) public void buildObject_null_oafRel() throws Exception { converter.convert(null); }
@Test public void buildObject() throws Exception { String projectId = "someProjectId"; String organizationId = "someOrgId"; ProjectToOrganization projOrg = converter.convert(createOafRelObject(projectId, organizationId)); assertNotNull(projOrg); assertEquals(projectId, projOrg.getProjectId()); assertEquals(organizationId, projOrg.getOrganizationId()); }