atom feed6 messages in org.codehaus.jmock.userChanging expectations
FromSent OnAttachments
Harald UelandNov 26, 2007 4:36 am 
Keith SaderNov 26, 2007 6:06 am 
Nat PryceNov 26, 2007 11:59 am 
Dale KingNov 27, 2007 9:25 am 
Wim DeblauweMay 11, 2009 1:42 am 
Nat PryceMay 11, 2009 11:40 am 
Subject:Changing expectations
From:Harald Ueland (
Date:Nov 26, 2007 4:36:09 am


Is there a way to change return values for expectations after they are set? I want to do this for some tests where 99 % of the test methods use predefined expectations set up from setUp(), but a few needs other return values.


void setUp() { expectation1 returns status1 expectation2 returns status2 }

99 % of the tests use status1 and status2 to go green, but one test needs expectation2 to return another status.

How can this be done without calling a setup method in all the tests? I have tried to return an instance variable from the expectations, but that didn't work. In JMock 1 the method reset() could be used to reset expectations. Have not found a similar method in JMock 2.