jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-4026

MockFor and StubFor improvements

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.0
  • Fix Version/s: 1.7.1, 1.8-beta-1
  • Component/s: mocks and stubs
  • Labels:
    None
  • Patch Submitted:
    Yes

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
    }
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    groovy4026_MockFor_StubFor_enhancements.patch
    31/Jan/10 6:34 PM
    7 kB
    Paul King

Issue Links

depends upon

New Feature - A new feature of the product, which has yet to be developed. GROOVY-2630 Support Half-Mocks

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
supercedes

Bug - A problem which impairs or prevents the functions of the product. GROOVY-1871 New MockFor support for properties means not possible to mock just methods

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Bug - A problem which impairs or prevents the functions of the product. GROOVY-1864 MockFor property support requires "demands" for all property access

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Paul King added a comment - 31/Jan/10 6:34 PM

proposed patch attached

Show
Paul King added a comment - 31/Jan/10 6:34 PM proposed patch attached
Hide
Permalink
Paul King added a comment - 01/Feb/10 7:42 AM - edited

Possibly supercedes GROOVY-1864

Show
Paul King added a comment - 01/Feb/10 7:42 AM - edited Possibly supercedes GROOVY-1864
Hide
Permalink
Paul King added a comment - 01/Feb/10 7:43 AM

Possibly supercedes GROOVY-1871

Show
Paul King added a comment - 01/Feb/10 7:43 AM Possibly supercedes GROOVY-1871
Hide
Permalink
Paul King added a comment - 07/Feb/10 7:03 AM

New features described further in GROOVY-2630 which talks about half-mocks.

Show
Paul King added a comment - 07/Feb/10 7:03 AM New features described further in GROOVY-2630 which talks about half-mocks.
Hide
Permalink
Paul King added a comment - 07/Feb/10 7:05 AM

Fixed in trunk

Show
Paul King added a comment - 07/Feb/10 7:05 AM Fixed in trunk

People

  • Assignee:
    Paul King
    Reporter:
    Paul King
Vote (0)
Watch (0)

Dates

  • Created:
    31/Jan/10 6:31 PM
    Updated:
    07/Apr/10 11:46 PM
    Resolved:
    07/Feb/10 7:05 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.