mock jasper report server using mockito

567 views
Skip to first unread message

Sudhir Babu B

unread,
Nov 26, 2015, 11:24:54 AM11/26/15
to mockito
The application makes https calls to Jasper reports server and this needs to be tested using Mockito.  I am not sure how to mock jasper reports server using mockito.  please help me.  Thank you.  


Marcin Zajączkowski

unread,
Nov 26, 2015, 4:00:37 PM11/26/15
to moc...@googlegroups.com
If you would like to create integration tests Wiremock might be an
interesting tool: http://wiremock.org/

In case of Mockito and unit testing you could for example add you own
layer used in all communication with Jasper server (all your code uses
only that class(es) which delegate requests to the server) and stub
calls of its methods (from your services).

Marcin

--
http://blog.solidsoft.info/ - Working code is not enough

Eric Lefevre-Ardant

unread,
Nov 26, 2015, 9:46:59 PM11/26/15
to moc...@googlegroups.com
In your situation, I would isolate the calls to Jasper in a small "JasperReportServer" class (it needs to be small to reduce the risk of bugs there), and use Mockito to check the behaviour of the higher-level class that is using it.

Ideally, the JasperReportServer class would be so simple that I wouldn't even unit-test it. However, I do sometimes create a limited number of integration tests to verify that JasperReportServer works OK (although these tests end up being rather brittle, since they rely on the state of an external server that is not controlled well by the tests).

On 27 November 2015 at 00:24, Sudhir Babu B <sudhir...@gmail.com> wrote:
The application makes https calls to Jasper reports server and this needs to be tested using Mockito.  I am not sure how to mock jasper reports server using mockito.  please help me.  Thank you.  


--
You received this message because you are subscribed to the Google Groups "mockito" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mockito+u...@googlegroups.com.
To post to this group, send email to moc...@googlegroups.com.
Visit this group at http://groups.google.com/group/mockito.
To view this discussion on the web visit https://groups.google.com/d/msgid/mockito/4b1693cb-362d-4e89-967f-3d6766c2f14d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages