@Test public void testLengthTrue() { // arrange Point _pointA = new Point(2, 5); Point _pointB = new Point(5, 9); double expected = 5; LineSegment _arcAB = new LineSegment(_pointA, _pointB); // act double reached = _arcAB.length(); // assert boolean result = (expected == reached); assertTrue(result); }
@Test public void testEqualsLineSegmentTheSameFalse2() { // arrange Point _pointA = new Point(5, 5); Point _pointB = new Point(2, 2); Point _pointC = new Point(2, 2); Point _pointD = new Point(4, 4); LineSegment _arcAB = new LineSegment(_pointA, _pointB); LineSegment _arcCD = new LineSegment(_pointC, _pointD); boolean expected = false; // act boolean reached = _arcAB.equals(_arcCD); // assert boolean result = !(expected ^ reached); assertTrue(result); }
@Test public void testShiftLineSegmentFalse() { // arrange Point _pointA = new Point(2, 2); Point _pointB = new Point(4, 4); boolean expected = false; LineSegment _arcAB = new LineSegment(_pointA, _pointB); Point _pointAAfter = new Point(4, 4); Point _pointBAfter = new Point(8, 8); LineSegment _arcABShifted = new LineSegment(_pointAAfter, _pointBAfter); // act _arcAB.shift(2, 2); boolean reached = _arcAB.equals(_arcABShifted); // assert boolean result = !(expected ^ reached); assertTrue(result); }