@Test public void whenInitFrogWithDefaultParametersThenResultStringWithLengthSevenAndCoordinates() { final Position startPos = new Position(11, 7); final Position finalPos = new Position(9, 10); final Position treeOne = new Position(14, 9); final Position treeTwo = new Position(5, 8); ArrayList<Position> trees = new ArrayList<>(); trees.add(treeOne); trees.add(treeTwo); try (ByteArrayOutputStream output = new ByteArrayOutputStream()) { System.setOut(new PrintStream(output)); new Frog(startPos, finalPos, trees).init(); assertThat(output.toString(), is(String.format( "Minimum length: 7%sPath:(11,7)(14,7)(1,7)(4,7)(6,8)(7,6)(8,8)(9,10)%s", sep, sep))); } catch (IOException io) { io.printStackTrace(); } }
public void init() { recursiveJump(startPos.getX(), startPos.getY(), 0, 0, -1, shortestPath); System.out.println(String.format("Minimum length: %s", minCount)); System.out.println(shortestPath); }
Frog { public void init() { recursiveJump(startPos.getX(), startPos.getY(), 0, 0, -1, shortestPath); System.out.println(String.format("Minimum length: %s", minCount)); System.out.println(shortestPath); } }
Frog { public void init() { recursiveJump(startPos.getX(), startPos.getY(), 0, 0, -1, shortestPath); System.out.println(String.format("Minimum length: %s", minCount)); System.out.println(shortestPath); } Frog(Position startPos, Position finalPos, List<Position> trees); }
Frog { public void init() { recursiveJump(startPos.getX(), startPos.getY(), 0, 0, -1, shortestPath); System.out.println(String.format("Minimum length: %s", minCount)); System.out.println(shortestPath); } Frog(Position startPos, Position finalPos, List<Position> trees); void init(); String lineFormat(String prevPath, int x, int y); }
Frog { public void init() { recursiveJump(startPos.getX(), startPos.getY(), 0, 0, -1, shortestPath); System.out.println(String.format("Minimum length: %s", minCount)); System.out.println(shortestPath); } Frog(Position startPos, Position finalPos, List<Position> trees); void init(); String lineFormat(String prevPath, int x, int y);  }