### Question:
Grid implements Iterable<Grid.Point> { public Point findPosition(final Point anchorPoint, final Direction direction) { int width = getWidth(); int height = getHeight(); int x = anchorPoint.getX(); int y = anchorPoint.getY(); switch (direction) { case NORTH: x -= width / 2; y -= height; break; case SOUTH: x -= width / 2; break; case EAST: y -= height / 2; break; case WEST: x -= width; y -= height / 2; break; case NONE: x -= width / 2; y -= height / 2; break; case NORTH_EAST: y -= height; break; case SOUTH_EAST: break; case SOUTH_WEST: x -= width; break; case NORTH_WEST: x -= width; y -= height; break; default: throw new UnsupportedOperationException(); } return new Point(x, y); } Grid(final int padding,
                final int iconSize,
                final int rows,
                final int cols); Point findPosition(final Point anchorPoint,
                              final Direction direction); Point findPosition(final int row,
                              final int col); @Override Iterator<Point> iterator(); int getRows(); int getCols(); int size(); int getWidth(); int getHeight();  }### Answer:
@Test public void testFindSimplePosition() { Point p = grid.findPosition(4, 5); assertEquals(160, p.getX()); assertEquals(130, p.getY()); }
@Test(expected = IllegalArgumentException.class) public void testFindSimplePositionRowIsTooBig() { grid.findPosition(10000, 5); }
@Test(expected = IllegalArgumentException.class) public void testFindSimplePositionColIsTooBig() { grid.findPosition(5, 10000); }
@Test(expected = IllegalArgumentException.class) public void testFindSimplePositionNegativeRow() { grid.findPosition(-1, 5); }
@Test(expected = IllegalArgumentException.class) public void testFindSimplePositionNegativeCol() { grid.findPosition(5, -1); }