Hey,
I am doing a Junit test case, but I keep having issues with AssertEquals ( object expected, object actual).
I don't know how to reference the other actual object so that it can compare to the expected. Please help, I am stuck
public void add (Distance d) throws CustomException { //I can also convert feet to inches and add all inches together and then divided inches to feet and inches Distance result = new Distance(); int newFeet = this.feet + d.getFeet(); int newInches = this.inches + d.getInches(); if(newInches > 11) { newFeet = newFeet + (newInches/12); newInches = newInches % 12; } result.setFeet(newFeet); result.setInches(newInches); System.out.println("Addition: " + result); }public class DistanceTest { @Test public void testAdd() { // Distance num = new Distance (5,5); // Distance test = new Distance (5,5); Distance result = new Distance (10,10); assertEquals(result,num.add(test)); //API uses assertEquals(object expected, object actual) }