@@ -0,0 +1,2291 @@
+package com.github.pedrovgs.problem38;%0A%0Aimport com.github.pedrovgs.binarytree.BinaryNode;%0Aimport java.util.List;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * @author Pedro Vicente G%C3%B3mez S%C3%A1nchez.%0A */%0Apublic class PathToEveryLeafTest %7B%0A%0A  private PathToEveryLeaf pathToEveryLeaf;%0A%0A  @Before public void setUp() %7B%0A    pathToEveryLeaf = new PathToEveryLeaf();%0A  %7D%0A%0A  @Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullTrees() %7B%0A    pathToEveryLeaf.calculate(null);%0A  %7D%0A%0A  @Test public void shouldReturnOneElementWithJustOneNodeIfTheTreeContainsJustOneElement() %7B%0A    BinaryNode%3CInteger%3E root = new BinaryNode%3CInteger%3E(1);%0A%0A    List%3CList%3CBinaryNode%3E%3E paths = pathToEveryLeaf.calculate(root);%0A%0A    assertEquals(1, paths.size());%0A    assertEquals(1, paths.get(0).get(0).getData());%0A  %7D%0A%0A  @Test public void shouldReturnTwoListsIfTheTreeContainsTwoLeafs() %7B%0A    BinaryNode%3CInteger%3E root = new BinaryNode%3CInteger%3E(1);%0A    BinaryNode%3CInteger%3E n2 = new BinaryNode%3CInteger%3E(2);%0A    BinaryNode%3CInteger%3E n3 = new BinaryNode%3CInteger%3E(3);%0A    root.setLeft(n2);%0A    root.setRight(n3);%0A%0A    List%3CList%3CBinaryNode%3E%3E paths = pathToEveryLeaf.calculate(root);%0A%0A    assertEquals(2, paths.size());%0A    assertPathTo(paths.get(0), root, n2);%0A    assertPathTo(paths.get(1), root, n3);%0A  %7D%0A%0A  @Test public void shouldCalculatePathsToEveryLeaf() %7B%0A    BinaryNode%3CInteger%3E root = new BinaryNode%3CInteger%3E(1);%0A    BinaryNode%3CInteger%3E n2 = new BinaryNode%3CInteger%3E(2);%0A    BinaryNode%3CInteger%3E n3 = new BinaryNode%3CInteger%3E(3);%0A    BinaryNode%3CInteger%3E n4 = new BinaryNode%3CInteger%3E(4);%0A    BinaryNode%3CInteger%3E n5 = new BinaryNode%3CInteger%3E(5);%0A    root.setLeft(n2);%0A    root.setRight(n3);%0A    n3.setLeft(n4);%0A    n3.setRight(n5);%0A%0A    List%3CList%3CBinaryNode%3E%3E paths = pathToEveryLeaf.calculate(root);%0A%0A    assertEquals(3, paths.size());%0A    assertPathTo(paths.get(0), root, n2);%0A    assertPathTo(paths.get(1), root, n3, n4);%0A    assertPathTo(paths.get(2), root, n3, n5);%0A  %7D%0A%0A  private void assertPathTo(List%3CBinaryNode%3E binaryNodes, BinaryNode... expectedNodes) %7B%0A    assertEquals(binaryNodes.size(), expectedNodes.length);%0A    for (int i = 0; i %3C binaryNodes.size(); i++) %7B%0A      assertEquals(expectedNodes%5Bi%5D, binaryNodes.get(i));%0A    %7D%0A  %7D%0A%7D%0A

Add some tests to problem 38