Question: public class Point { private int x; private int y; public Point(int x, int y) { this.x=x; this.y=y; } @Override public boolean equals(Object o) {
public class Point { private int x; private int y; public Point(int x, int y) { this.x=x; this.y=y; } @Override public boolean equals(Object o) { // What code goes here? } } 1 (a) How do we *know* what code is appropriate (or not) for the equals() method?
(b) Write the code for equals() in the Point class. What would we do if Point extended some other class?
(c) let's develop some regular JUnit tests for equals() .
(d) let's develop some data-driven JUnit tests for equals().
(e) Develop some theories about the equals() method. Implement them as JUnit theories. Don't worry about Java syntax; worry about what you want to test.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
