Skip to content

Nested criteria querying works incorrectly with mock domain objects #14617

@rmorrise

Description

@rmorrise

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. Download the sample app:
    https://github.com/rmorrise/nested-query-mock-test

  2. Verify that the app works properly:
    grails run-app
    On the index page, a Grandchild object is rendered as JSON.

  3. Execute the unit tests:
    grails test-app
    The TestControllerSpec fails.

Expected Behaviour

The TestController.index() method should respond with a Grandchild object, causing the test to pass.

Actual Behaviour

TestController.index() responds with an empty list.

Note: The test will pass if all of the domain objects have the same ID value.

Environment Information

  • Operating System: Win 7 x64
  • Grails Version: 2.3.8 w/GORM 6.1.0.RELEASE
  • JDK Version: 1.8.0_121-b13
  • Container Version (If Applicable): N/A

Example Application

https://github.com/rmorrise/nested-query-mock-test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions