Point { protected static boolean isPt2BetweenPt1AndPt3(LongPoint pt1, LongPoint pt2, LongPoint pt3) { if (pt1.equals(pt3) || pt1.equals(pt2) || pt3.equals(pt2)) { return false; } else if (pt1.getX() != pt3.getX()) { return pt2.x > pt1.x == pt2.x < pt3.x; } else { return pt2.y > pt1.y == pt2.y < pt3.y; } } protected  Point(Point<T> pt); protected  Point(T x, T y, T z); @Override boolean equals(Object obj); void set(Point<T> other); void setX(T x); void setY(T y); void setZ(T z); @Override String toString();  }
@Test public void isPt2BetweenPt1AndPt3Test() { LongPoint pt1 = new LongPoint(); LongPoint pt2 = new LongPoint(); LongPoint pt3 = new LongPoint(); Assert.assertFalse(Point.isPt2BetweenPt1AndPt3(pt1, pt2, pt3)); pt3.setX(10L); pt3.setY(10L); Assert.assertFalse(Point.isPt2BetweenPt1AndPt3(pt1, pt2, pt3)); pt2.setX(10L); pt2.setY(10L); Assert.assertFalse(Point.isPt2BetweenPt1AndPt3(pt1, pt2, pt3)); pt2.setX(5L); pt2.setY(10L); Assert.assertTrue(Point.isPt2BetweenPt1AndPt3(pt1, pt2, pt3)); pt1.setX(10L); pt1.setY(0L); pt2.setX(10L); pt2.setY(5L); Assert.assertTrue(Point.isPt2BetweenPt1AndPt3(pt1, pt2, pt3)); }