vendredi 20 mai 2016

Spock: method invocation was not detected for equals parameters

1 * dao.update(_ as Category) check fails, what is wrong? And how fix this?

Test

dao.update(_ as Category) >> { argument ->
      assert firstCategory.equals(argument.get(0))//debug passes this good
}
def c = new CategoryController(categoryDAO: dao)

when:
    print(firstCategory.toString())
    def put = performPut("/category", firstCategory)//calls CategoryController

then:
    1 * dao.update(_ as Category)

Faill:

Category{id=1463754783000, name='null', image='null', parent=null}
Too few invocations for:

1 * dao.update(firstCategory)   (0 invocations)

Unmatched invocations (ordered by similarity):

1 * dao.update(Category{id=1463754783000, name='null', image='null', parent=null})

Aucun commentaire:

Enregistrer un commentaire