Announcement Announcement Module
Collapse
No announcement yet.
Setting dynamic 'properties' for a domain during testing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting dynamic 'properties' for a domain during testing

    I have some grails code which sets up a domain object from a parameters map:

    SomeDomainObject new = new SomeDomainObject()
    new.properties = params

    At runtime it sets up all the properties of the domain object correctly. However if I run this in an integration test, it does not.

    My test class does something like:

    Controller controller = new Controller()
    controller.params = new GrailsParameterMap(new MockHttpServletRequest())
    controller.params.arg = value
    ...

    It seems that during testing the dynamic properties method is not working properly.

    I am using grails 1.1.

    Any ideas?

    Thank you.

    -- Justin
    Last edited by justinbroughton; Nov 14th, 2010, 02:44 PM.

  • #2
    That's rather an old version of Grails to be using! Anyway, with an integration test you should not be modifying the 'params' property itself. So your code should look like:
    Code:
    Controller controller = new Controller()
    controller.params.arg = value

    Comment


    • #3
      You can also set parameter maps by suggested approaches on:

      http://grails.1312388.n4.nabble.com/....html#a3039994

      Jet

      Comment


      • #4
        Trying upgrade

        We are going to try upgrading to the latest Grails version and see if it makes a difference.

        Thanks.

        Comment

        Working...
        X