### Question:
FileSystemModel implements TreeModel { @Override public int getIndexOfChild(final Object parent, final Object child) { File directory = (File) parent; File file = (File) child; String[] children = directory.list(); for (int i = 0; i < children.length; i++) { if (file.getName().equals(children[i])) { return i; } } return -1; } FileSystemModel(final File rootDirectory); @Override Object getRoot(); @Override Object getChild(final Object parent, final int index); @Override int getChildCount(final Object parent); @Override boolean isLeaf(final Object node); @Override int getIndexOfChild(final Object parent, final Object child); @Override void valueForPathChanged(final TreePath path, final Object value); @Override void addTreeModelListener(final TreeModelListener listener); @Override void removeTreeModelListener(final TreeModelListener listener);  }### Answer:
@Test public void testGetIndexOfChild() { String testRoot = IRODS_TEST_SUBDIR_PATH + "/testGetIndexOfChild"; String childRoot = testRoot + "/hitherechild1"; String childRoot2 = testRoot + "/hitherechild2"; String absPath = scratchFileUtils.createAndReturnAbsoluteScratchPath(testRoot); String otherDir = scratchFileUtils.createAndReturnAbsoluteScratchPath(childRoot); String otherDir2 = scratchFileUtils.createAndReturnAbsoluteScratchPath(childRoot2); FileSystemModel instance = new FileSystemModel(new File(absPath)); File instance2 = new File(otherDir2); File parent = new File(absPath); int expected = 1; int result = instance.getIndexOfChild(parent, instance2); assertEquals(expected, result); }