Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-2571

Using MockHstRequestContext in unit tests causes ClassCastException

    XMLWordPrintable

Details

    Description

      HstSitePipeline seems to try to cast the input requestContext to MockHstRequestContext implicitly.
      So, if you use MockHstRequestContext in your unit tests, it causes a ClassCastException like the following logs:

      java.lang.ClassCastException: org.hippoecm.hst.mock.core.request.MockHstRequestContext cannot be cast to org.hippoecm.hst.core.internal.HstMutableRequestContext
      at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.<init>(HstSitePipeline.java:261)
      at org.hippoecm.hst.core.container.TestHstSitePipeline.testPageCacheContext(TestHstSitePipeline.java:274)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      ...

      Attachments

        Activity

          People

            jsheriff Junaidh Kadhar Sheriff
            wko Woonsan Ko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: