### Question:
AbstractBoard extends AbstractLayeredBoard<E> { public int countNear(int x, int y, E element) { int count = 0; for (int layer = 0; layer < countLayers(); ++layer) { count += countNear(layer, x, y, element); } return count; }  abstract E valueOf(char ch); ClientBoard forString(String boardString); @Override AbstractBoard forString(String... layers); List<Point> get(E... elements); boolean isAt(int x, int y, E element); boolean isAt(Point point, E element); E getAt(int x, int y); E getAt(Point point); List<E> getAllAt(int x, int y); List<E> getAllAt(Point point); String boardAsString(); boolean isAt(int x, int y, E... elements); boolean isAt(Point point, E... elements); boolean isNear(int x, int y, E element); boolean isNear(Point point, E element); int countNear(int x, int y, E element); int countNear(Point point, E element); List<E> getNear(int x, int y); List<E> getNear(Point point); void set(int x, int y, char ch); char[][] getField();  }### Answer:
@Test public void shouldWork_countNear() { assertEquals(2, board.countNear(0, 0, Elements.ONE)); assertEquals(1, board.countNear(0, 0, Elements.TWO)); assertEquals(0, board.countNear(0, 0, Elements.THREE)); assertEquals(5, board.countNear(1, 1, Elements.ONE)); assertEquals(1, board.countNear(1, 1, Elements.TWO)); assertEquals(2, board.countNear(1, 1, Elements.THREE)); assertEquals(5, board.countNear(2, 2, Elements.ONE)); assertEquals(2, board.countNear(2, 2, Elements.TWO)); assertEquals(1, board.countNear(2, 2, Elements.THREE)); assertEquals(2, board.countNear(3, 3, Elements.ONE)); assertEquals(0, board.countNear(3, 3, Elements.TWO)); assertEquals(1, board.countNear(3, 3, Elements.THREE)); assertEquals(0, board.countNear(-1, -1, Elements.THREE)); }