Skip to content

Instantly share code, notes, and snippets.

@nhajratw
Created April 29, 2010 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhajratw/384259 to your computer and use it in GitHub Desktop.
Save nhajratw/384259 to your computer and use it in GitHub Desktop.
Please excuse my embarrassing Groovy code. This is a simplified cuke4duke Step definition.
GroceryService is a java class that makes a call to repository.findByNamedQueryAndNamedParam("Store.by_zip_code_with_active_promotions", "zip", "48176")
The error i'm getting is:
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: groovy.mock.interceptor.MockFor.findByNamedQueryAndNamedParam() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String) values: [Store.by_zip_code_with_active_promotions, zip, 48176] (NativeException)
When(~"the service is invoked") {
store = new Store()
stores = new ArrayList()
stores.add(store)
repository = new MockFor(IRepository)
repository.demand.findByNamedQueryAndNamedParam { stores }
groceryService.setRepository(repository as IRepository);
testData.response = groceryService.getStoresByZipCode(12345, "48176")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment