### Question:
Knight extends Figure { public Cell[] way(Cell source, Cell dest) throws ImpossibleMoveException { int differenceX = Math.abs(dest.getX() - source.getX()); int differenceY = Math.abs(dest.getY() - source.getY()); if (dest.getX() < 0 && dest.getY() < 0 && dest.getX() > 9 && dest.getY() > 9 && ((differenceX != 2 && differenceY != 1) || (differenceX != 1 && differenceY != 2))) { throw new ImpossibleMoveException("Конь так не ходит"); } return new Cell[]{dest}; } Knight(Cell position); Cell[] way(Cell source, Cell dest); Figure copy(Cell dest);  }### Answer:
@Test public void ifKnightGoingFromPointFourFourToPointThreeTwo() throws ImpossibleMoveException { Knight testKnight = new Knight(new Cell(4, 4)); Cell[] result = testKnight.way(new Cell(4, 4), new Cell(3, 2)); assertThat(result, is(new Cell[]{new Cell(3, 2)})); }
@Test public void ifKnightGoingFromPointFourFourToPointTwoThree() throws ImpossibleMoveException { Knight testKnight = new Knight(new Cell(4, 4)); Cell[] result = testKnight.way(new Cell(4, 4), new Cell(2, 3)); assertThat(result, is(new Cell[]{new Cell(2, 3)})); }
@Test public void ifKnightGoingFromPointFourFourToPointTwoFive() throws ImpossibleMoveException { Knight testKnight = new Knight(new Cell(4, 4)); Cell[] result = testKnight.way(new Cell(4, 4), new Cell(2, 5)); assertThat(result, is(new Cell[]{new Cell(2, 5)})); }
@Test public void ifKnightGoingFromPointFourFourToPointThreeSix() throws ImpossibleMoveException { Knight testKnight = new Knight(new Cell(4, 4)); Cell[] result = testKnight.way(new Cell(4, 4), new Cell(3, 6)); assertThat(result, is(new Cell[]{new Cell(3, 6)})); }
@Test public void ifWrongWayThenReturnImeException() { Knight testKnight = new Knight(new Cell(4, 4)); try { testKnight.way(new Cell(4, 4), new Cell(5, 5)); } catch (ImpossibleMoveException ime) { assertThat("Конь так не ходит", is(ime.getMessage())); } }