1
글쎄, 지금 레거시 코드를 테스트 중입니다. 그리고, 나는이 시험을 통과 할 수있는 가까운 곳이지만, 그것에 대한 의견이있는 라인에 붙어있다. 여기에 조각 result
의 모든 값이 조롱하는, 반면테스트중인 클래스의 개인 메서드로 호출을 바꾸는 방법
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();
에게 있습니다.
다른 곳에서 인스턴스가 생성되는 'to'입니까? – Feanor
@Feanor : 모형 (mockup) 인스턴스입니다. –
'mockup instance'는 결과가 'to'에 할당 된이 NonStrictExpectations 레코드 단계에 다른 호출이 있음을 명확히하기 위해? – Feanor