### Question:
Vector2D { public void translate(Vector2D offset) { Objects.requireNonNull(offset, "Offset cannot be null."); x += offset.x; y += offset.y; } Vector2D(double x, double y); double getX(); double getY(); void translate(Vector2D offset); Vector2D translated(Vector2D offset); void rotate(double angle); Vector2D rotated(double angle); void scale(double scaler); Vector2D scaled(double scaler); Vector2D copy(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test void testTranslate() { var vector = new Vector2D(5, 10); vector.translate(new Vector2D(-10, -20)); assertEquals(new Vector2D(-5, -10), vector); }
@Test void testTranslateByNull() { assertThrows(NullPointerException.class, () -> new Vector2D(1, 2).translate(null)); }