### Question:
Vector2 extends AVector2 { public Vector2 subtract(final IVector vector) { setX(x() - vector.x()); setY(y() - vector.y()); return this; } protected  Vector2(); protected  Vector2(final double x, final double y); protected  Vector2(final IVector original); static Vector2 zero(); static Vector2 fromX(final double x); static Vector2 fromY(final double y); static Vector2 fromXY(final double x, final double y); static Vector2 fromAngle(final double angle); static Vector2 fromAngleLength(final double angle, final double length); static Vector2 fromPoints(final IVector2 start, final IVector2 end); static Vector2 copy(final IVector original); static Vector2 fromReal(final RealVector vector); @Override Vector2 copy(); Vector2 set(final IVector original); Vector2 setX(final double x); Vector2 setY(final double y); void set(final int i, final double value); Vector2 add(final IVector vector); Vector2 subtract(final IVector vector); Vector2 multiply(final double factor); Vector2 scaleTo(final double newLength); Vector2 turn(final double angle); Vector2 turnTo(final double angle); Vector2 normalize(); @Override Vector2 getXYVector(); @Override double x(); @Override double y();  }### Answer:
@Test public void testSubtract() { Vector2 vec1 = Vector2.fromXY(4, 2); Vector2 vec2 = Vector2.fromXY(3, 5); vec1.subtract(vec2); assertEquals(Vector2.fromXY(1, -3), vec1); vec1 = Vector2.fromXY(1, 5); vec2 = Vector2.fromXY(-2, 5); vec1.subtract(vec2); assertEquals(Vector2.fromXY(3, 0), vec1); vec2 = Vector2.fromXY(2.4f, -3.1f); vec1.subtract(vec2); assertEquals(vec1.x(), 0.6, ACCURACY); assertEquals(vec1.y(), 3.1, ACCURACY); }