lundi 12 septembre 2016

How do I add unit test for [ignoreCase: true] in grails 2.4.5?

public List<User> myMethod(String value, String field) {

        return User.createCriteria().list {
            ne("status", Status.DELETED)
            eq("${field}", value, [ignoreCase: true])
        }
    }

I have the code above and it keeps throwing out the error in my unit test:

MyService.eq() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, java.lang.String, java.util.LinkedHashMap) values: [username, someUsernameYouWant, [ignoreCase:true]]
Possible solutions: grep(), any(), wait(), every(), find(), dump()

if remove [ignoreCase:true] the test passes. Is there a way to test this like mock it? because this method is being used by a number of methods inside the same service. I just want the methods who use myMethod to friggin pass, because myMethod already has an integration test and I'm trying to do a unit tests for the tests that call it..

Aucun commentaire:

Enregistrer un commentaire