Test controller is as follows
def justTest(){
def res = paymentService.justTest()
[status: res.status]
}
Test service method is as f
I would take a different approach:
void test1(){
controller.paymentService = new PaymentService() {
def justTest() {['status': true]}
}
def res = controller.justTest()
assertEquals(res.status, true)
}
Or if you were using Spock instead of JUnit:
void test1() {
controller.parymentService = Stub() {
justTest() >> [status: true]
}
// ... other code
}