示例类
public class Test{
@Tested ClassA objA;
@Test(expected = MyException.class){
String expectedVar = "expectedVar";
new Expectations(objA)
{
{
objA.someMethod();
result = expectedVar;
}
};
// So here is error, when I debug the programm it doesn't even enter following method.
// If I connent out new Expectations(){{...}} block, only then the programm
// will enter the method objA.execute()
objA.execute();
}
谁能解释这里发生了什么以及为什么对某些方法设置期望会改变其他方法的行为?