how can I create a test method using asseertEquals for method Boolean isEqual(Semester semester) with Boolean type in class Semester?
here is the code for class Semester and the junit test for class Semester
public class Semester {
private String year;
private String name;
public Semester() {
year = null;
name = null;
}
public Semester(String year, String name) {
this.year = year;
this.name = name;
}
public boolean isEqual(Semester semestr) {
return ((semestr.name.equals(this.name)) && (semestr.year
.equals(this.year)));
}
public String getYear() {
return year;
}
public String getName() {
return name;
}
}
public class SemesterTestCase1 {
private Semester semster=new Semester("2014","Fall");
@Test
public void testIsEqual() {
}
@Test
public void testGetYear() {
assertEquals("2014",semster.getYear());
}
@Test
public void testGetName() {
assertEquals("Fall",semster.getName());
}
}
Aucun commentaire:
Enregistrer un commentaire