In my class under test (CUT) - an ejb - I have a private method "getConnection". I want to test another method of the CUT but this method will fail before hand.
I tried it like shown below, but "invoke" is wrong. I don't want to invoke the method, I want to stub it. But how? ('connection' is a stub)
new NonStrictExpectations() {
{
invoke(archivingBean, "getConnection");result = connection;
}
};
archivingBean.moveCreditBasic2Archive(new Date());