@Test
public void testFamily() {

  FamilySearchPlatform g = makeDoc();
  FamilyView family = g.getPerson().getDisplayExtension().getFamiliesAsChild().get(0);
  // parent1-parent2 relationship
  Relationship couple = g.findCoupleRelationship(family);
  assertEquals(RelationshipType.Couple, couple.getKnownType());
  assertEquals("#parent1", couple.getPerson1().getResource().toString());
  assertEquals("#parent2", couple.getPerson2().getResource().toString());
  // parent1-kid1 relationship
  Relationship pcRel = g.findParentChildRelationship(family.getParent1(), family.getChildren().get(0));
  assertEquals(RelationshipType.ParentChild, pcRel.getKnownType());
  assertEquals("#parent1", pcRel.getPerson1().getResource().toString());
  assertEquals("#kid1", pcRel.getPerson2().getResource().toString());
  assertEquals(FactType.AdoptiveParent, pcRel.getFacts().get(0).getKnownType());
  assertNull(pcRel.getFacts().get(0).getValue());
  // parent2-kid1 relationship
  pcRel = g.findParentChildRelationship(family.getParent2(), family.getChildren().get(0));
  assertEquals(RelationshipType.ParentChild, pcRel.getKnownType());
  assertEquals("#parent2", pcRel.getPerson1().getResource().toString());
  assertEquals("#kid1", pcRel.getPerson2().getResource().toString());
  assertEquals(FactType.BiologicalParent, pcRel.getFacts().get(0).getKnownType());
  // parent2-kid2 relationship
  pcRel = g.findParentChildRelationship(family.getParent2(), family.getChildren().get(1));
  assertEquals(RelationshipType.ParentChild, pcRel.getKnownType());
  assertEquals("#parent2", pcRel.getPerson1().getResource().toString());
  assertEquals("#kid2", pcRel.getPerson2().getResource().toString());
  assertNull(pcRel.getFacts());
  // Now also look up ChildAndParentsRelationship
  ChildAndParentsRelationship rel = g.findChildAndParentsRelationship(family.getChildren().get(0), family.getParent1(), family.getParent2());
  assertEquals("#parent1", rel.getParent1().getResource().toString());
  assertEquals("#parent2", rel.getParent2().getResource().toString());
  assertEquals("#kid1", rel.getChild().getResource().toString());
  assertEquals(FactType.AdoptiveParent, rel.getParent1Facts().get(0).getKnownType());
  assertEquals(FactType.BiologicalParent, rel.getParent2Facts().get(0).getKnownType());
  rel = g.findChildAndParentsRelationship(family.getChildren().get(1), family.getParent1(), family.getParent2());
  assertEquals("#parent1", rel.getParent1().getResource().toString());
  assertEquals("#parent2", rel.getParent2().getResource().toString());
  assertEquals("#kid2", rel.getChild().getResource().toString());
  assertNull(rel.getParent1Facts());
  assertNull(rel.getParent2Facts());
  // Test single-parent family
  FamilyView fam2 = g.getPerson().getDisplayExtension().getFamiliesAsChild().get(1);
  rel = g.findChildAndParentsRelationship(fam2.getChildren().get(0), fam2.getParent1(), fam2.getParent2());
  assertEquals("#parent1", rel.getParent1().getResource().toString());
  assertNull(rel.getParent2());
  assertEquals("#kid3", rel.getChild().getResource().toString());
  assertNull(g.findCoupleRelationship(fam2));
}