PagedResultList Instance in Grails 3.1.7 Unit Test -


is possible create pagedresultlist instance or mock?

for background: i´m writing controller unit tests. if necessary stubbing service function calls. of functions have pagedresultlist return type. have inject pagedresultlist instance or null.

in cases need instance because controller this:

testfunction(){     def result = sampleservice.dosomething()      if (result.empty) {         variable = "it´s empty"     }     render variable } 

my test looking this:

void "sample test"(){     given:         controller.sampleservice = mock(sampleservice)         pagedresultlist emptypagedresultlist = ?????      when:         controller.testfunction()      then:         1 * controller.sampleservice.dosomething() >> emptypagedresultlist         response.text == "it´s empty" } 

someone can me replace ????? pice of code fix issue?

thanks in advance.

yes, there couple options here:


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -