[
https://issues.apache.org/jira/browse/WICKET-6092?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15135030#comment-15135030
]
Jeremy Sss commented on WICKET-6092:
------------------------------------
I started with a basic quickstart application and made sure my homepage had the
following:
{code:title=HomePage.java|borderStyle=solid}
public HomePage(final PageParameters parameters) {
super(parameters);
add(new Label("version",
getApplication().getFrameworkSettings().getVersion()));
// TODO Add your page's components here
((HttpServletResponse)getRequestCycle().getResponse().getContainerResponse()).getHeaderNames();
}
{code}
Then I ran the default unit tests which include the following:
{code:title=TestHomePage.java|borderStyle=solid}
tester.startPage(HomePage.class);
{code}
It errored on this line and looking at the stack trace, it ended with:
...
Caused by: java.lang.AbstractMethodError:
org.apache.wicket.protocol.http.mock.MockHttpServletResponse.getHeaderNames()Ljava/util/Collection;
at org.example.HomePage.<init>(HomePage.java:19)
... 47 more
> MockHttpServletResponse causes AbstractMethodError during unit tests
> --------------------------------------------------------------------
>
> Key: WICKET-6092
> URL: https://issues.apache.org/jira/browse/WICKET-6092
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 6.21.0, 7.2.0
> Reporter: Jeremy Sss
> Assignee: Martin Grigorov
> Priority: Minor
>
> As early as Wicket 6.x the Wicket documentation has specified that it
> supports Java's Servlet API v2.5 or newer
> (https://wicket.apache.org/start/wicket-6.x.html#servlet-api). Java's Servlet
> API v3.x specifies that classes who implement the HttpServletResponse
> interface must implement the getHeaderNames() method which returns the type
> Collection<String>
> (http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletResponseWrapper.html#getHeaderNames--).
> While preforming unit tests using WicketTester, Wicket helpfully uses the
> MockHttpServletResponse class which defines a getHeaderNames() method that
> returns type Set<String>
> (https://ci.apache.org/projects/wicket/apidocs/7.x/org/apache/wicket/protocol/http/mock/MockHttpServletResponse.html#getHeaderNames()).
>
> While running unit tests for code that makes use of the getHeaderNames()
> method, an AbstractMethodError is thrown due to the incorrect method
> signature. Wicket's MockHttpServletResponse should implement and override the
> getHeaderNames() method with the same signature as defined in
> HttpServletResponse.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)