Skip to content

UrlMappingsUnitTestMixin does not check exception mappings #10226

@joemccall86

Description

@joemccall86

By default the UrlMappingsUnitTestMixin does not perform a check against the type of exception inside UrlMappings.groovy. We currently sub-class UrlMappingsUnitTestMixin to test this feature, but I'd like to document its absence here.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create an entry in UrlMappings.groovy mapping different actions for the '500' location based on the exception thrown
  2. Create unit test that uses the UrlMappingsTestMixin to test using assertForwardUrlMapping
  3. Observe the test failure

Expected Behaviour

assertForwardUrlMapping will test the exception mapping in UrlMappings.groovy

Actual Behaviour

assertForwardUrlMapping only tests the action/controller, ignoring the exception.

Environment Information

  • Operating System: Ubuntu MATE 16.10
  • Grails Version: 3.1.12
  • JDK Version: OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)

Example Application

https://github.com/joemccall86/url-mappings-mixin-test

Other Notes

We have the workaround code already, and I'm putting together a PR to address this issue right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions