PathStore { public BaseExplorerElement.AddState getAddState(String path, int siblingsCount) { String[] folders = path.split(SystemHelper.SEPARATOR); Node current = mRoot; for (String segment : folders) { if (segment.length() <= 0) continue; Node next = current.get(segment); if (next == null) { return (current.hasChildren() || current == mRoot) ? BaseExplorerElement.AddState.NOT_ADDED : BaseExplorerElement.AddState.ADDED; } current = next; } if (current.hasChildren() && current.mChildren.size() < siblingsCount) return BaseExplorerElement.AddState.PARTLY_ADDED; else return BaseExplorerElement.AddState.ADDED; }  String[] getPaths(); void clearAdded(); BaseExplorerElement.AddState getAddState(String path, int siblingsCount); void add(String path); void remove(String path, List<BaseExplorerElement> siblings); boolean isEmpty();  }
@Test public void empty() throws Exception { PathStore store = new PathStore(); assertEquals(NOT_ADDED, store.getAddState("1" + SEPARATOR + "2" + SEPARATOR + "3", 4)); assertEquals(NOT_ADDED, store.getAddState("1" + SEPARATOR + "1", 3)); assertEquals(NOT_ADDED, store.getAddState("1" + SEPARATOR + "2", 3)); assertEquals(NOT_ADDED, store.getAddState("1" + SEPARATOR + "3", 3)); assertEquals(NOT_ADDED, store.getAddState("1" + SEPARATOR + "4", 3)); }