公共无效测试(对象 obj){
//Here i have to set the values of the obj using its setter .
}
可以使用两个对象作为参数调用测试。EG:test(standalone) 和 test(webapp),其中standalone 和 webapp 是 bean。
public class standalone{
int version;
//setter and getter
}
public class Webapp{
String version;
//setter and getter
}
此测试方法必须根据参数对象设置值。例如:如果我将独立作为参数传递。独立的 setter 方法 shd 被调用。如何做到这一点?
注意:不使用接口。这个怎么做?谢谢。