[jira] Created: (JMOCK-193) ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.

View: New views
6 Messages — Rating Filter:   Alert me  

[jira] Created: (JMOCK-193) ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.
-----------------------------------------------------------------------------------------

                 Key: JMOCK-193
                 URL: http://jira.codehaus.org/browse/JMOCK-193
             Project: jMock
          Issue Type: Improvement
          Components: Library
    Affects Versions: 2.5.0-RC2
         Environment: Any
            Reporter: James Abley
         Attachments: return-enumeration-action.patch

I was looking to create this class and found you already had; albeit not in the released version that I was using.

A suggestion for a minor addition to the API.

Patch with tests attached.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (JMOCK-193) ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=141217#action_141217 ]

Nat Pryce commented on JMOCK-193:
---------------------------------

I'm not keen on this.  Creating the action will consume the enumeration, which feels wrong.

If creating an action will also change the state of its argument, it's better for that to be made explicit by calling Collections.list(enumeraiton) at the point in the test where the action is created.

> ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.
> -----------------------------------------------------------------------------------------
>
>                 Key: JMOCK-193
>                 URL: http://jira.codehaus.org/browse/JMOCK-193
>             Project: jMock
>          Issue Type: Improvement
>          Components: Library
>    Affects Versions: 2.5.0-RC2
>         Environment: Any
>            Reporter: James Abley
>         Attachments: return-enumeration-action.patch
>
>
> I was looking to create this class and found you already had; albeit not in the released version that I was using.
> A suggestion for a minor addition to the API.
> Patch with tests attached.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (JMOCK-193) ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=141221#action_141221 ]

James Abley commented on JMOCK-193:
-----------------------------------

I can see that viewpoint. My suggestion is based on my mocking of HttpServletRequest, which I typically do using this approach:

http://eternusuk.blogspot.com/2007/10/java-mock-objects-tip.html

I could move to using Arrays.asList(...) to define a collection to enumerate. That would be homogeneous with the existing ReturnIteratorAction as well, so it's no biggie.

> ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.
> -----------------------------------------------------------------------------------------
>
>                 Key: JMOCK-193
>                 URL: http://jira.codehaus.org/browse/JMOCK-193
>             Project: jMock
>          Issue Type: Improvement
>          Components: Library
>    Affects Versions: 2.5.0-RC2
>         Environment: Any
>            Reporter: James Abley
>         Attachments: return-enumeration-action.patch
>
>
> I was looking to create this class and found you already had; albeit not in the released version that I was using.
> A suggestion for a minor addition to the API.
> Patch with tests attached.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (JMOCK-193) ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=141227#action_141227 ]

Nat Pryce commented on JMOCK-193:
---------------------------------

That example can be rewritten using varargs as follows, which I think is easier to read:

        one(httpServletRequest).getParameterNames();
            will(returnEnumeration("c", "d", "e"));




> ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.
> -----------------------------------------------------------------------------------------
>
>                 Key: JMOCK-193
>                 URL: http://jira.codehaus.org/browse/JMOCK-193
>             Project: jMock
>          Issue Type: Improvement
>          Components: Library
>    Affects Versions: 2.5.0-RC2
>         Environment: Any
>            Reporter: James Abley
>         Attachments: return-enumeration-action.patch
>
>
> I was looking to create this class and found you already had; albeit not in the released version that I was using.
> A suggestion for a minor addition to the API.
> Patch with tests attached.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (JMOCK-193) ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=141596#action_141596 ]

James Abley commented on JMOCK-193:
-----------------------------------

Yes, thanks for the pointer. I originally started using the StringTokenizer thing when still working under Java 1.4, but I'm still not fully au fait with all of the language changes in Java 5.

> ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.
> -----------------------------------------------------------------------------------------
>
>                 Key: JMOCK-193
>                 URL: http://jira.codehaus.org/browse/JMOCK-193
>             Project: jMock
>          Issue Type: Improvement
>          Components: Library
>    Affects Versions: 2.5.0-RC2
>         Environment: Any
>            Reporter: James Abley
>         Attachments: return-enumeration-action.patch
>
>
> I was looking to create this class and found you already had; albeit not in the released version that I was using.
> A suggestion for a minor addition to the API.
> Patch with tests attached.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Closed: (JMOCK-193) ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/JMOCK-193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nat Pryce closed JMOCK-193.
---------------------------

      Assignee: Nat Pryce
    Resolution: Won't Fix

> ReturnEnumerationAction should take an enumeration as part of the overloaded constructor.
> -----------------------------------------------------------------------------------------
>
>                 Key: JMOCK-193
>                 URL: http://jira.codehaus.org/browse/JMOCK-193
>             Project: jMock
>          Issue Type: Improvement
>          Components: Library
>    Affects Versions: 2.5.0-RC2
>         Environment: Any
>            Reporter: James Abley
>            Assignee: Nat Pryce
>         Attachments: return-enumeration-action.patch
>
>
> I was looking to create this class and found you already had; albeit not in the released version that I was using.
> A suggestion for a minor addition to the API.
> Patch with tests attached.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email