Open GoogleCodeExporter opened 9 years ago
Original comment by julien.g...@gmail.com
on 19 Apr 2009 at 2:25
Should we support 'mock.method(1, 2).returns(1).and(3, 4).returns(2)'?
Original comment by JohnnyJianHY
on 23 Apr 2009 at 10:58
I would prefer people to use two line for this type of thing. It would get a bit
unreadable.
Original comment by julien.g...@gmail.com
on 24 Apr 2009 at 8:10
Then, its usage is limited. I wonder whether this feature is useful.
Original comment by JohnnyJianHY
on 24 Apr 2009 at 11:12
I think it still useful. We basically define two entry point for a return.
Original comment by julien.g...@gmail.com
on 25 Apr 2009 at 7:53
Consider:
mock.methodB(1, 2).or(3, 4).returns(0)
Which of the following should pass?
1. play {}
2. play {
assertEquals 0, mock.methodB(1, 2)
}
3. play {
assertEquals 0, mock.methodB(3, 4)
}
4. play {
assertEquals 0, mock.methodB(1, 2)
assertEquals 0, mock.methodB(3, 4)
}
Original comment by JohnnyJianHY
on 25 Apr 2009 at 11:08
I would say 2 and 3. If it was a 'and' then it would be 4 only.
Is that would you had in mind?
Original comment by julien.g...@gmail.com
on 25 Apr 2009 at 11:17
I was not sure about 4.
I think we can support 'mock.method(1).and(2).and(3).returns(0)' and
'mock.method(1).or(2).or(3).returns(1)'. But what about
'mock.method(1).and(2).or(3).returns(2)'? Seems it doesn't make any sense.
Original comment by JohnnyJianHY
on 25 Apr 2009 at 11:35
What are you not sure about the 4. 'And' or 'Or'?
I agree mixing 'and' and 'or' doesn't make much sense.
Original comment by julien.g...@gmail.com
on 14 May 2009 at 6:31
I was not sure about 'or'. Because when 'or' is a logical operator, if 'A' and
'B'
are both true, 'A or B' is true.
Original comment by JohnnyJianHY
on 14 May 2009 at 6:44
I start to doubt the usefulness and readability of this feature. Let's just
shelve it and wait for someone vote for it.
Original comment by JohnnyJianHY
on 21 Aug 2011 at 4:25
If using the command expression based DSL of Groovy 1.8, this feature may be
readable:
mock.methodA(1, 2) and (3, 4) returns 0
Original comment by JohnnyJianHY
on 20 Dec 2011 at 3:26
Original comment by JohnnyJianHY
on 20 Dec 2011 at 5:34
Original issue reported on code.google.com by
JohnnyJianHY
on 19 Apr 2009 at 2:18