### Question:
Pointer implements Serializable { public int getTargetIndex() throws JWNLException { if (null == target) { if (null != source.getDictionary() && source.getDictionary().isEditable()) { return getTarget().getIndex(); } else { return targetIndex.index; } } else { return target.getIndex(); } } Pointer(PointerTarget source, PointerType pointerType, POS targetPOS, long targetOffset, int targetIndex);  Pointer(PointerType pointerType, PointerTarget source, PointerTarget target); String toString(); int getSourceIndex(); PointerType getType(); boolean isLexical(); boolean isSemantic(); boolean isSymmetricTo(Pointer that); PointerTarget getSource(); PointerTarget getTarget(); void setTarget(PointerTarget target); Synset getTargetSynset(); long getTargetOffset(); int getTargetIndex(); POS getTargetPOS(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testGetTargetIndexWord() throws JWNLException { Synset s = new Synset(dictionary, POS.NOUN, 1); Synset t = new Synset(dictionary, POS.NOUN, 2); Word tw = new Word(dictionary, t, "test"); t.getWords().add(tw); Pointer p = new Pointer(s, PointerType.ANTONYM, POS.NOUN, 2, 1); Assert.assertEquals(1, p.getTargetIndex()); }
@Test public void testGetTargetIndex() throws JWNLException { Synset s = new Synset(null, POS.NOUN, 1); Pointer p = new Pointer(s, PointerType.ANTONYM, POS.NOUN, 2, 0); Assert.assertEquals(0, p.getTargetIndex()); }
@Test public void testGetTargetIndexEdit() throws JWNLException { dictionary.edit(); Synset s = new Synset(dictionary, POS.NOUN, 1); Synset t = new Synset(dictionary, POS.NOUN, 2); Pointer p = new Pointer(s, PointerType.ANTONYM, POS.NOUN, 2, 0); Assert.assertEquals(0, p.getTargetIndex()); }