@Test public void divideByScalarReturnsNewPointWithEachCoordinateDividedByTheScalarValueSpecified() throws Exception { Point point = new Triple(8, 6, 12).divide(2); assertPointEquals(new Triple(4, 3, 6), point); }
@Test public void divideByScalarLeavesStateOfThisObjectUnchanged() throws Exception { Point point = new Triple(10, 20, 30); point.divide(5); assertPointEquals(new Triple(10, 20, 30), point); }
@Test public void addReturnsDifferenceOfTheTwoInvolvedPoints() throws Exception { Point point = new Triple(1, 2, 3).add((Point) new Triple(4, 5, 6)); assertPointEquals(new Triple(5, 7, 9), point); }
@Test public void subtractRetunsDifferenceOfTheTwoInvolvedPoints() throws Exception { Point point = new Triple(1, 2, 3).subtract(new Triple(4, 5, 6)); assertPointEquals(new Triple(-3, -3, -3), point); }
@Test public void addDoesNotChangeStateOfTheParameterPoint() throws Exception { Point point = new Triple(1, 2, 3); new Triple(4, 5, 6).add(point); assertPointEquals(new Triple(1, 2, 3), point); }
@Test public void addDoesNotChangeStateOfThisPoint() throws Exception { Point point = new Triple(1, 2, 3); point.add(new Triple(4, 5, 6)); assertPointEquals(new Triple(1, 2, 3), point); }