好吧,我现在正在测试遗留代码。而且,我在某个地方附近可以通过这个测试,但它卡在有评论的地方。这是片段
new NonStrictExpectations(){
SASCustomerDataAssemblerBD assembleBd;
CustomerTOs tos;
CustomerSASTO to;
Another rowTo;
SelectionJobLogBD logBd;
{
SASCustomerDataAssemblerBD.getInstanceUsingEjbRef(); result = assembleBd;
assembleBd.getData(); result = tos;
..
..
//This line is not being invoked.
//Instead the actual line of code is working. Which is,
//Collections.max(someCollection, someComparator);
//Hence I am stuck because getting null in "to"
invoke(Collections.class, "max", new ArrayList(), new MaxDateComparator()); result = to;
to.getSasDataRow(); result = rowTo;
SelectionJobLogBD.getInstanceUsingEjbRef(); result = logBd;
..
}
};
new TaskSASCustomerReading().execute();
然而,所有的值result
都是模拟的。