Mocking a service that calls another service

Mocking a service that calls another service

I have a method, say m1 in class, say C1. Method m1 calls a method, say m2 from another service class, say C2. So I mock m2 in junit test-cases for m1. However, m2 itself calls a third method, say m3 from a third class, say C3. When I run the test-cases for m1, they fail with the exception:

junit.framework.AssertionFailedError: null

On debugging my code, I found that reference to C3 in the mock for C2 was null. I tried mocking both C2 and C3. Yet the same problem occurred. Please help me understand how to correct this situation and run my test-cases successfully.

View Answers

Ads









Related Tutorials/Questions & Answers:
Mocking a service that calls another service
Mocking a service that calls another service  I have a method, say m1 in class, say C1. Method m1 calls a method, say m2 from another service class, say C2. So I mock m2 in junit test-cases for m1. However, m2 itself calls
VoIP Service
or upgrade their PBX. All local and long distance calls are included with the service... VoIP Service VoIP Service Provider Solutions Emergent Network Solutions mission is to provide real, deliverable VoIP service provider solutions
Advertisements
web service
web service  i want to make an web service example so please help me out thanks  
xcode web service example
xcode web service example  xcode web service example
web service
would be grateful :):) So i want to creat a web service that display the bus... coordinate will be send to my web service in a array list but i cant translate this into a code; my problem is in the web service side : in wich class i will do
service
Web Service
"; ServiceFactory factory = ServiceFactory.newInstance(); Service service
Web Service
"; ServiceFactory factory = ServiceFactory.newInstance(); Service service
ModuleNotFoundError: No module named 'as-a-service'
ModuleNotFoundError: No module named 'as-a-service'  Hi, My Python... 'as-a-service' How to remove the ModuleNotFoundError: No module named 'as-a-service' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'as-a-service'
ModuleNotFoundError: No module named 'as-a-service'  Hi, My Python... 'as-a-service' How to remove the ModuleNotFoundError: No module named 'as-a-service' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'service'
ModuleNotFoundError: No module named 'service'  Hi, My Python... 'service' How to remove the ModuleNotFoundError: No module named 'service... to install padas library. You can install service python with following command
unable to open the service tomcat5
unable to open the service tomcat5  While trying to run tomcat server getting "unable to open the service tomcat5" error after installed tomcat
restart elasticsearch service centos
restart elasticsearch service centos  Hi I have elasticsearch server on Centos. How to restart elasticsearch service centos? Thanks   Hi, In centos elasticserch is installed as service. It can be restarted
How to Convert SOAP Web service to REST Web service In Java ?
How to Convert SOAP Web service to REST Web service In Java ?  I want to Convert SOAP Web service(WSDL) to REST web service in JSON Format with GET... service. What I know is that JAX-RS api is used to generate REST Web service
MongoDB uninstall windows service
the MongoDB on my Winodws Computer as service. Now I want to uninstall the mongodb from windows service. Can any one tell me How to uninstall the MongoDB from windows server? Thanks   Hi, You can remove the MongoBD service using
What is the default cache service of hibernate?
What is the default cache service of hibernate?  Hi, What is the default cache service of hibernate? Thanks
web service & database
web service & database  Hi, I need help with importing data from web service to ms sql/my sql. I developed a web service using Axis2 (v1.6.2) and Tomcat (v7.0.27) running on Eclipse Indigo. I can connect to the web services
clarify bt/w service() and doget/dopost()
clarify bt/w service() and doget/dopost()   Dear friends, i ve question regarding service()and doget/dopost.. the container calls service() where it does the service for the request so then wat is the role of doget/dopost plz
web service frameworks
Web service Frameworks         Web service Frameworks: There are many frameworks for web services. Here is the list of some frameworks
web service protocols
Web service Protocols         Web service protocols: Here is the list of some protocols used for Web Services
Version of com.disdar>extraction-service dependency
List of Version of com.disdar>extraction-service dependency
Version of com.intersult>abraxas-service dependency
List of Version of com.intersult>abraxas-service dependency
Version of com.ricardoespsanto>onesky-service dependency
List of Version of com.ricardoespsanto>onesky-service dependency
Version of com.sdl>odata_service dependency
List of Version of com.sdl>odata_service dependency
Version of com.shipdream>service-core dependency
List of Version of com.shipdream>service-core dependency
Version of com.tsc9526>monalisa-service dependency
List of Version of com.tsc9526>monalisa-service dependency
Fax service in Java application.
Fax service in Java application.  Hello, I want to develop a Java application to send fax to any destination fax numbers. Anyone who knows about this, please tell how I can do this. Is there any free libraries
ModuleNotFoundError: No module named 'aio-service'
ModuleNotFoundError: No module named 'aio-service'  Hi, My Python... 'aio-service' How to remove the ModuleNotFoundError: No module named 'aio-service' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'async-service'
ModuleNotFoundError: No module named 'async-service'  Hi, My... 'async-service' How to remove the ModuleNotFoundError: No module named 'async-service' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'async-service'
ModuleNotFoundError: No module named 'async-service'  Hi, My... 'async-service' How to remove the ModuleNotFoundError: No module named 'async-service' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'bert-service'
ModuleNotFoundError: No module named 'bert-service'  Hi, My Python... 'bert-service' How to remove the ModuleNotFoundError: No module named 'bert-service' error? Thanks   Hi, In your python

Ads