Sample class
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();
}
Could anyone explain what is happening here and why setting expectations on some method changes behaviour of other method?