@Test public void shouldAddNewNodeToChildrenListWhenCurrentNodeIsNotLastInIndexTree() { LevelIndex<Integer> levelindex = levelIndex().withLevelCount(1).build(); LevelNode<Integer> root = new LevelNode<Integer>(levelindex); int currentLevelNumber = 0; root.add(new String[]{"A"}, 10, currentLevelNumber); assertThat(root).hasNoLeaves().hasDirectChild("A"); }
void add(List<String> levels, T leafValue, int depth) { String[] levelsArray = levels.toArray(new String[levels.size()]); add(levelsArray, leafValue, depth); }
LevelNode { void add(List<String> levels, T leafValue, int depth) { String[] levelsArray = levels.toArray(new String[levels.size()]); add(levelsArray, leafValue, depth); } }
LevelNode { void add(List<String> levels, T leafValue, int depth) { String[] levelsArray = levels.toArray(new String[levels.size()]); add(levelsArray, leafValue, depth); } LevelNode(LevelIndex<T> index);  LevelNode(String level, LevelNode<T> parent, LevelIndex<T> index); }
LevelNode { void add(List<String> levels, T leafValue, int depth) { String[] levelsArray = levels.toArray(new String[levels.size()]); add(levelsArray, leafValue, depth); } LevelNode(LevelIndex<T> index);  LevelNode(String level, LevelNode<T> parent, LevelIndex<T> index); boolean hasChildren(); boolean isLeaf(); Map<String, LevelNode<T>> getChildren(); LevelNode<T> getDefaultNode(); List<T> getLeafList(); T getLeafValue(); void printNode(StringBuilder sb, int level); @Override String toString(); }
LevelNode { void add(List<String> levels, T leafValue, int depth) { String[] levelsArray = levels.toArray(new String[levels.size()]); add(levelsArray, leafValue, depth); } LevelNode(LevelIndex<T> index);  LevelNode(String level, LevelNode<T> parent, LevelIndex<T> index); boolean hasChildren(); boolean isLeaf(); Map<String, LevelNode<T>> getChildren(); LevelNode<T> getDefaultNode(); List<T> getLeafList(); T getLeafValue(); void printNode(StringBuilder sb, int level); @Override String toString();  }