lundi 28 mars 2016

how to mock util classes in grails service unit testing

class PropertyDetailsServiceSpec extends Specification {
void "test one"(){
    when:
    Map pdData = service.buildViewData()
    then:
    pdData != null
}
}

class PropertyDetailsService{
    buildViewData(){
      UtilClass obj=new UtilClass();
      obj.utilFunc();
    }
}

i want to mock utilFunc method how do i do that? grails version: 3.0.10

Aucun commentaire:

Enregistrer un commentaire