### Question:
RelationshipList extends ArrayList<Relationship> { @Override public boolean add(Relationship relationship) { int curSize = size(); boolean success = super.add(relationship); if (1 == size()) { shallowestIndex = 0; deepestIndex = 0; } else { if (success) { Relationship shallowest = get(shallowestIndex); Relationship deepest = get(deepestIndex); if (relationship.getDepth() < shallowest.getDepth()) { shallowestIndex = curSize; } if (relationship.getDepth() > deepest.getDepth()) { deepestIndex = curSize; } } } return success; } RelationshipList(); @Override boolean add(Relationship relationship); Relationship getShallowest(); Relationship getDeepest();  }### Answer:
@Test public void testAdd() throws JWNLException { RelationshipList l = new RelationshipList(); Assert.assertNull(l.getShallowest()); Assert.assertNull(l.getDeepest()); Relationship r = new SymmetricRelationship(PointerType.ANTONYM, new PointerTargetNodeList(), new Synset(null, POS.NOUN), new Synset(null, POS.NOUN)); l.add(r); Assert.assertEquals(r, l.getDeepest()); Assert.assertEquals(r, l.getShallowest()); }