tags:

views:

92

answers:

2

I recently upgraded to grails 1.1.1 and while my application works fine, my tests are having some serious issues:

for unit tests some mocks are failing, it seems like anything that calls a method from a domain class isn't working, for instance

def boolean isParameterized() { return (parameters != null && !parameters.isEmpty()) }

is called by an if statement in a controller, and in the test for the controller (which extends the ControllerUnitTestCase) this mock is created

reportDefinitionControl.demand.isParameterized { -> return false }

but when I run the tests, isParametrized is true, which is made more confusing by the fact that the mocked instance would have isParametrized be false anyway, because parameters is empty.

For my integration tests, it seems like the application can't compile and I get error messages like

[INFO] Compilation Error: Compilation Failed [INFO] Error running integration tests: java.lang.ClassNotFoundException: project.alert.AlertTypeTests [WARNING] java.lang.ClassNotFoundException: project.alert.AlertTypeTests

anybody got any tips?

A: 

maybe groovy is checking if isParametrized is null and it concludes it isn't since it contains a closure.

are you testing: false==reportDefinitionControl.isParametrized() or false==reportDefinitionControl.isParametrized ?

Xymor
the exact if statement is:if(!reportDefinitionControl.isParametrized() )I was under the impression that groovy logic treats null and false identically (in if statements, not in general), but I would not be surprised if that's not true.
A: 

I think you probably are missing the equal symbol after 'isParameterized'

reportDefinitionControl.demand.isParameterized = { -> return false }

Regards.

Robert