Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.0
-
None
-
Patch
Description
MockFor and StubFor provide powerful features for mocking but it would be good to have some additional convenience methods and enhancements.
- Proposed number of times feature:
mock.demand.hasNext(3) { true }
as shorthand for:
mock.demand.hasNext(3..3) { true }
- Proposed ignore feature supports code fragments like:
def mock = new MockFor(AlphaIterator) def expectedCount = 2 mock.ignore('next'){ /* ignored */ } mock.demand.hasNext(expectedCount){ true } mock.demand.hasNext{ false } mock.use { assert new IteratorCounter().count(new AlphaIterator()) == expectedCount }
Attachments
Attachments
Issue Links
- depends upon
-
GROOVY-2630 Support Half-Mocks
- Closed
- supercedes
-
GROOVY-1871 New MockFor support for properties means not possible to mock just methods
- Closed
-
GROOVY-1864 MockFor property support requires "demands" for all property access
- Closed