You need to wire the mock service into the exportService object. If you have a setter for the service member variable then do this:
exportService.setService(serviceMock);// add this line.
exportService.export();
If you don't have a setter you will need to perform the wiring before calling export. Options for this include:
- Set the value of the service member variable using reflection.
- Write a test-only version of the Service and use a test-only version of the spring configuration xml files.
- Something else (that I have never done and thus don't know about).