[ 
https://issues.apache.org/jira/browse/SLING-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533068#comment-16533068
 ] 

Jason E Bailey commented on SLING-7744:
---------------------------------------

[~kwin] I've found the throwing of an error on a method that's not implemented 
counter productive. Yes it communicates that the method won't work as expected. 
But there is then no way to make that method work. I was unable to mock a 
method that does nothing but throw an error message. So if you are working with 
pre-existing code that calls that method. You're kinda hosed. So I agree with 
your suggestion but I think the PR is better then what's there.

> MockRequestPathInfo: Add Setter for SuffixResource
> --------------------------------------------------
>
>                 Key: SLING-7744
>                 URL: https://issues.apache.org/jira/browse/SLING-7744
>             Project: Sling
>          Issue Type: Improvement
>          Components: Servlets, Testing
>    Affects Versions: Servlet Helpers 1.1.6
>            Reporter: Jens Lauterbach
>            Priority: Minor
>         Attachments: SLING-7744.patch
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> The {{org.apache.sling.servlethelpers.MockRequestPathInfo}} allows consumers 
> to set almost every field except the {{suffixResource}}. Currently, the 
> {{getSuffixResource()}} just throws a {{UnsupportedOperationException}}.
> *I propose implementing a {{setSuffixResource}} method equivalent to all the 
> other setters in this mock.*
> As far as I can tell this can be easily implemented (see attached patch) and 
> would improve usability of this mock a little bit.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to