From: Robert Klemme Date: 2008-11-07T07:58:14+09:00 Subject: Re: Redefine while On 06.11.2008 16:43, Emil Sandin wrote: > A good idea, but isn't working in my case. If I mock the condition I > change the behaviour of the method under test too much. But thanks > anyway! I find your approach suspicious: you write a class with a method whose regular behavior involves executing a loop. Then, during tests you want the loop to not loop, i.e. you change the behavior of your method. Strictly speaking the test result is then meaningless, because you do not test the behavior of the method that you want to use regularly. If there is a complex operation in the loop that you want to test separately you should probably refactor the code. Then you can have your one off test. Cheers robert