import junit.*;
import junit.framework.TestCase;
import static org.junit.Assert.*;
public class StudentTest extends TestCase {
public void testCreate(){
final String firstStudentName="Jane Doe";
Student firstStudent=new Student(firstStudentName);
assertEquals(firstStudentName, firstStudent.getName());
final String secondStudentName="Joe Blow";
Student secondStudent=new Student(secondStudentName);
assertEquals(secondStudentName, secondStudent.getName());
}
}
class Student
{
private String name;
Student(String name){
this.name=name;
}
String getName(){
return name ;
}
}
Agile Java(第一章)
最新推荐文章于 2021-02-20 12:17:27 发布