You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Nicholas Blair (JIRA)" <ji...@apache.org> on 2010/03/18 02:50:27 UTC
[jira] Commented: (PLUTO-589) alter return types in
org.apache.pluto.container.om.portlet.Filter?
[ https://issues.apache.org/jira/browse/PLUTO-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846716#action_12846716 ]
Nicholas Blair commented on PLUTO-589:
--------------------------------------
Example test for a FilterChain impl, attempting to create a mock filter:
Filter mockFilter = EasyMock.createMock(Filter.class);
EasyMock.expect(mockFilter.getFilterClass()).andReturn("org.jasig.portal.portlet.container.MockRenderFilter");
EasyMock.expect(mockFilter.getFilterName()).andReturn("mockFilterName");
List<InitParam> params = new ArrayList<InitParam>();
EasyMock.expect(mockFilter.getInitParams()).andReturn(params);
These lines will not compile, since the return type of getInitParams() does not match the type of the params variable.
One cannot switch the params variable to a concrete implementation of InitParam, like so:
List<InitParamType> params = new ArrayList<InitParamType>();
Also a compilation failure, due to type mismatch.
This may simply be a problem to pin on EasyMock and not Pluto, however it is a somewhat awkward return type.
> alter return types in org.apache.pluto.container.om.portlet.Filter?
> -------------------------------------------------------------------
>
> Key: PLUTO-589
> URL: https://issues.apache.org/jira/browse/PLUTO-589
> Project: Pluto
> Issue Type: Improvement
> Components: portlet container
> Affects Versions: 2.0.0
> Reporter: Nicholas Blair
>
> The return type for the getInitParams() method in org.apache.pluto.container.om.portlet.Filter is List<? extends InitParam>.
> This presents an awkward scenario, one particularly present when creating unit tests for a FilterChain implementation and attempting to create mock Filter implementations.
> The requirement that getInitParams return a class that implements an interface _that extends_ InitParam. You cannot simply return a class that implements InitParam; you would need to define your own custom interface that extends InitParam, and implement your custom interface.
> If the InitParam interface satisfactorily defines what's needed, the getInitParams return should be a class that simply implements InitParam.
> Is it possible to modify the return value for getInitParams to simply?
> List<InitParam>
> This also applies to the getDescriptions and getDisplayNames method in the same class; both have return values of List<? extends someinterface>, it should simply be List<interface>.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.