Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:56:41+00:00 2026-05-29T22:56:41+00:00

How do I use executeQuery in grails testcase? A error : groovy.lang.MissingMethodException: No signature

  • 0

How do I use executeQuery in grails testcase?

A error : groovy.lang.MissingMethodException: No signature of method ***.executeQuery() is applicable for argument types: () values: []

I have already called mockDomain.

By the way, it is in unit test.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:56:42+00:00Added an answer on May 29, 2026 at 10:56 pm

    There’s no support for HQL queries in unit tests yet, but we’re working on it. But you shouldn’t be doing persistence tests with mocks. Persistence tests should be done against a database in an integration test.

    I usually move HQL queries to the domain class as static query methods. This way they’re easy to mock in a unit test of a controller, service, etc. and then I test the method as part of the domain class integration test.

    For example I’d have

    class User {
       String username
       String password
       ...
    
       static List findAllUsersBlahBlah(String foo, boolean bar) {
          executeQuery('from User u where ...')
       }
    }
    

    Then in a unit test I can mock that method with fake data since I don’t care about persistence in a controller unit test – I know that it’s properly tested in the correct place and I want to focus on the class under test, not its collaborators:

    def users = [new User(...), new User(...)]
    User.metaClass.static.findAllUsersBlahBlah = { String foo, boolean bar -> users }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i use webflow in a my grails application, i have 2 tables with relation
I have a Java application and I want to use SQL database. I have
i use java hibernate i have 2 Tables Table1 and Table2 with many to
Okay i know i have to use the JDBC etc, but im not sure
I have a question about my mysql query syntax When i use this $result
I'm using the Statement's for executeUpdate and executeQuery. The string values I'm concatenating into
I saw this example somewhere: rs = connection.prepareStatement(select * from table).executeQuery(); Could I use
I have this PHP code that I use to make a dropdown form selection
I have a java code that use a stored procedure for that it is:
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.