### Question:
RelationshipFinder { public static int getImmediateRelationship(IndexWord sourceWord, IndexWord targetWord) { List<Synset> senses = sourceWord.getSenses(); String lemma = targetWord.getLemma(); for (int i = 0; i < senses.size(); i++) { if (senses.get(i).containsWord(lemma)) { return i + 1; } } return -1; }  static int getImmediateRelationship(IndexWord sourceWord, IndexWord targetWord); static RelationshipList findRelationships(
            Synset sourceSynset, Synset targetSynset, PointerType type); static RelationshipList findRelationships(
            Synset sourceSynset, Synset targetSynset, PointerType type, int depth);  }### Answer:
@Test public void testImmediateRelationshipPositive() throws JWNLException { dictionary.edit(); Synset s1 = dictionary.createSynset(POS.NOUN); Synset s2 = dictionary.createSynset(POS.NOUN); Synset s3 = dictionary.createSynset(POS.NOUN); IndexWord i1 = dictionary.createIndexWord(POS.NOUN, "test", s1); IndexWord i2 = dictionary.createIndexWord(POS.NOUN, "rest", s2); IndexWord i3 = dictionary.createIndexWord(POS.NOUN, "best", s3); i1.getSenses().add(s2); Assert.assertEquals(2, RelationshipFinder.getImmediateRelationship(i1, i2)); Assert.assertEquals(-1, RelationshipFinder.getImmediateRelationship(i1, i3)); Assert.assertEquals(-1, RelationshipFinder.getImmediateRelationship(i2, i3)); }