import student.TestCase; /** * * @author nickgrifasi * @version 10/11/21 * Tests the Point class and its methods. */ public class PointTest extends TestCase { /** * Tests all the getter methods of the Points */ public void testGetters() { Point getter = new Point("getter", 5, 5); assertEquals("getter", getter.getName()); assertEquals(5, getter.getXCord()); assertEquals(5, getter.getYCord()); assertEquals("(getter, 5, 5)", getter.toString()); } /** * tests the equals() method */ public void testEquals() { Point point1 = new Point("test1", 3, 3); Point point2 = new Point("test1", 3, 3); Point point3 = new Point("test2", 1, 3); Point point4 = new Point("test3", 3, 1); Point point5 = null; assertTrue(point1.equals(point2)); assertFalse(point1.equals(point3)); assertFalse(point1.equals(point4)); Object object = new Object(); assertFalse(point4.equals(object)); assertFalse(point1.equals(point5)); } }