Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6092

MockHttpServletResponse causes AbstractMethodError during unit tests

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 6.21.0
    • None
    • wicket
    • None

    Description

      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.

      Attachments

        1. 6092.tgz
          25 kB
          Martin Tzvetanov Grigorov

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            pokej6 Jeremy Sss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: