我有这个 Java 程序,但我的测试给了我这个消息:
testEmployeeTostring: testEmployeeTostring 预期失败 <[id[= 1013, name= Jubal Early, job = ]procurement]> 但是:<[id[= 1013, name= Jubal Early, job = ] 采购]>
我不得不使用@Override
,我认为这就是问题所在。我希望有人能解决这个问题:
public class Employee {
int id;
String name;
JobType job;
public Employee(int id, String name, JobType job)
{
this.id = id;
this.name = name;
this.job = job;
}
@Override public String toString()
{
return ("["+ "id =" + id + ", name = " + name + ", job = " + job + "]");
}
}