Quick Index
Getting Started


The purpose of this challenge is to write a class "PointTests" that will test the class Point.

Create a new project working directory and copy your previously coded Point.java into the directory.

Hints:


Here is some code to help get started.

This code should go in a file named "PointTests.java".

The file should be placed in the same working directory as "Point.java".
public class PointTests {

	public void testMoveToOrigin() {

	}

	public void testMove1() {

	}

	//=======================================

	public static void main(String[] args) {
		PointTests test = new PointTests();
		test.testMoveToOrigin();
		test.testMove1();
	}

}

Methods To Test


For class Point we should have these four methods:


Expected Behavior - 'moveToOrigin'


Recall the Point's "moveToOrigin" method. For a given Point object the method does this:


Code The 'testMoveToOrigin' Method


Code "testMoveToOrigin" method in PointTests. This method can mimic the testSetSmall in RectangleTests.

The method should send the method "moveToOrigin" to a Point object (that you construct in the test method similar to testSetSmall).

And it should print out the x and y values by sending "getX" and "getY" to the Point object.

Compile and run.

👉🏼 Compare the actual output values to the expected values, and display each for output clarity (see "Example" page).

Expected Behavior - 'move1'


Recall the Point's "move1" method. For a given Point object the method does this:


Code The 'testMove1' Method


Code "testMove1" method in PointTests. This method will be very similar to "testMoveToOrigin".

The method should send the method "move1".

And it should print out the x and y values by sending "getX" and "getY" to the Point object.

Compile and run.

👉🏼 Compare the actual output values to the expected values for "moveToOrigin", and display each for output clarity (see "Example" page).

Grading


For this assignment, we will use these grading rules.

Troubleshooting


See this page