public class A{
protected Integer methodA(String a){
//some code is included;
return new Integer(1);
}
}
public class B extends B{
String b = "AnyThing";
methodA(b);
//there are also other methods that will be tested
}
以下是部分测试代码
B classUnderTest = createMockBuild(B.class).addMockedMethod(B.class.getDeclaredMethod(methodA(), String.class)).createMock;
expect(classUnderTest.methodA(anyObject(String.class))).andReturn(new Integer(1));
第二段代码的第二行甚至无法通过编译。哪里错了?