### Question:
FileSystemModel implements TreeModel { @Override public int getChildCount(final Object parent) { File file = (File) parent; if (file.isDirectory()) { String[] fileList = file.list(); if (fileList != null) { return file.list().length; } } return 0; } 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 testGetChildCount() { String testRoot = IRODS_TEST_SUBDIR_PATH + "/testGetRoot"; 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)); int expected = 2; int result = instance.getChildCount(instance.getRoot()); assertEquals(expected, result); }