我必须对如下所示的静态方法进行单元测试:
public static boolean someProcess(List<String> arg1, Properties props, String[] arg3, String arg4, String arg5) throws Exception {
boolean success = false;
Job1 job1 = new Job1(arg3, props.getProperty("prop1"), props.getProperty("prop2"), arg1.get(0), arg4, "asdf", arg5);
if(doJobAndCheckStatus(arg1, job1)) {
String someId = job1.someId;
Job2 job2 = new Job2(arg3, someId, arg4, arg5);
if(doJobAndCheckStatus(arg1, job2)) {
Job3 job3 = new Job3(arg3, someId, arg4, arg5);
if(doJobAndCheckStatus(arg1, job3)) {
String id2 = job3.id2;
Job4 job4 = new Job4(arg3, id2, props.getProperty("prop3"), arg4, arg5);
if(doJobAndCheckStatus(arg1, job4)) {
String id3 = job4.id3;
Job5 job5 = new job5(arg3, id3, arg4, arg5, props.getProperty("prop4"));
if(doJobAndCheckStatus(arg1, job5)) {
success = jobCompletedSuccessfully(arg1);
}
}
}
}
}
return success;
}
public static boolean doJobAndCheckStatus(List<String> arg1, JobParent job) {
job.processJob();
....
}
如上所示,在此静态方法中,有5个JobX类要初始化。所有这些Job类都是复杂的对象,它们将连接到外部系统。
我对该方法进行单元测试的想法是:
我的问题是:
任何启发都会受到高度赞赏!