I'm working on a test case and I'm having trouble. I'm having a hard time with getting my test cases to work. Here is the code:
public class Appointment extends Actor
{
int hour;
String description;
public Appointment(int hour, String description)
{
super();
this.hour = hour;
this.description = description;
}
public void setHour(int newHour)
{
newHour = hour;
}
}
/////////
public class AppointmentTest extends TestCase
{
private Appointment appointment;
private int hour;
private String description;
private String newDescription;
private int newHour;
public AppointmentTest()
{
}
public void setUp()
{
appointment = new Appointment(hour, description);
this.hour = hour;
this.description = description;
hour = 7;
description = "";
newHour = 1;
newDescription = "hello";
}
public void testSetHour()
{
appointment.setHour(1);
assertEquals(newHour, hour);
}
}
The issue is when I run my testcase it says that newhour is 7 ad hour is still 1. Does anyone know why?