Test Writing: Point Class Add Setters
Created By: Ellen Spertus
/ Version: 2023.12.0
Make x
and y
changeable by removing the final
keyword and adding
setters.
Test Design Challenge
You're challenge is to write tests for this problem described above.
- Provide a public class named TestPoint with a single non-private class method named test that accepts no arguments and does not return a value.
- If the implementation of the class described above is incorrect, your test method should throw an exception.
- If it is correct, do not throw an exception.
- You may want to use Java's assert method
public class Point {
private final double x;
private final double y;
public Point(double newX, double newY) {
x = newX;
y = newY;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
}