void () { String root = "/a"; String[] data = {"/a/b/c", "/a", "/a/b", "/d/e", "/b/c", "/a/d", "/a/b/c/d/e"}; ThreeState[] expected1 = {ThreeState.UNSURE, ThreeState.YES, ThreeState.YES, ThreeState.NO, ThreeState.NO, ThreeState.YES, ThreeState.UNSURE}; ThreeState[] expected2 = {ThreeState.UNSURE, ThreeState.NO, ThreeState.YES, ThreeState.NO, ThreeState.NO, ThreeState.YES, ThreeState.UNSURE}; for (int i = 0; i < data.length; i++) { ThreeState state = FileUtil.isAncestorThreeState(root, data[i], false); assertEquals(String.valueOf(i), expected1[i], state); } for (int i = 0; i < data.length; i++) { ThreeState state = FileUtil.isAncestorThreeState(root, data[i], true); assertEquals(String.valueOf(i), expected2[i], state); } }