### Question:
PenAreaBoundary implements Comparator<IVector2> { public Optional<IVector2> stepAlongBoundary(final IVector2 start, final double distance) { if (distance < 0) { return Optional.empty(); } ILineSegment edge = edgeOf(start); return stepAlongBoundary(start, edge, distance); } private  PenAreaBoundary(final double width, final double depth, final double sign); static PenAreaBoundary ownWithMargin(final double margin); PenAreaBoundary withMargin(final double margin); IVector2 closestPoint(final IVector2 p); IVector2 projectPoint(final IVector2 p); IVector2 projectPoint(final IVector2 p1, final IVector2 p2); Optional<IVector2> nextTo(final IVector2 p, final double margin, final int direction); Optional<IVector2> nextIntermediateCorner(final IVector2 pFrom, final IVector2 pTo); double distanceBetween(final IVector2 p1, final IVector2 p2); @Override int compare(IVector2 p1, IVector2 p2); Optional<IVector2> stepAlongBoundary(final IVector2 start, final double distance); boolean isPointInShape(IVector2 point); double getWidth(); double getDepth(); IVector2 getStart(); IVector2 getCorner1(); IVector2 getCorner2(); IVector2 getEnd(); IVector2 getCenter();  }### Answer:
@Test public void stepAlongBoundary() { List<ILineSegment> edges = penAreaBoundary.getEdges(); for (ILineSegment edge : edges) { Optional<IVector2> steppedPointPos = penAreaBoundary.stepAlongBoundary(edge.getStart(), edge.getLength() / 2); assertThat(steppedPointPos.isPresent() && edge.isPointOnLine(steppedPointPos.get())).isTrue(); Optional<IVector2> steppedPointNeg = penAreaBoundary.stepAlongBoundary(edge.getEnd(), -edge.getLength() / 2); assertThat(steppedPointNeg).isEmpty(); } for (ILineSegment edge : edges.subList(0, edges.size() - 2)) { Optional<IVector2> steppedPointPos = penAreaBoundary.stepAlongBoundary(edge.getStart(), edge.getLength() + 10); assertThat(steppedPointPos.isPresent() && edges.get(edges.indexOf(edge) + 1).isPointOnLine(steppedPointPos.get())).isTrue(); Optional<IVector2> steppedPointNeg = penAreaBoundary.stepAlongBoundary(edge.getEnd(), -(edge.getLength() + 10)); assertThat(steppedPointNeg).isEmpty(); } ILineSegment edge = edges.get(edges.size() - 1); Optional<IVector2> steppedPoint = penAreaBoundary.stepAlongBoundary(edge.getStart(), edge.getLength() + 10); assertThat(steppedPoint).isEmpty(); double penAreaLength = penAreaBoundary.getEdges().stream().mapToDouble(ILineSegment::getLength).sum(); steppedPoint = penAreaBoundary.stepAlongBoundary(penAreaBoundary.getStart(), penAreaLength - 1); assertThat(steppedPoint.isPresent() && edges.get(edges.size() - 1).isPointOnLine(steppedPoint.get())).isTrue(); }