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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!