java - How to test a Spring @RenderMapping method? -
i have spring method :
@rendermapping public string gotopage(renderrequest argrenderrequest, modelmap modelmap){ ..... }
how test method - gotopage
. should use easymock/mockito mock renderrequest
& modelmap
?
does annotation @rendermapping
have impact part of testing method ?
spring provides additional jar test support classes, called spring test.
there class mockrenderrequest. modelmap
, since class extends linkedhashmap
, not mock use directly.
of course, use easymock or mockito mock both classes, when spring provides mock/test class, prefer use this. of time, kind of classes container/beans , expensive mock.
for unit testing method, not take care of annotation @rendermapping
. own rule "unit test method content, rest belongs integration testing".
Comments
Post a Comment