I started off with writing unit test on webservice methods of my ejb project module. the WS flow has call to EJB methods to load DB data. As well tried mocking the xxDAOBean classes and methods using powermockito. It was successful. But the part of the WS involves working on DB data for preparing WS response. There too i mocked it. Mocking those DB data was sluggish. Then next step i want to progress was
- how could i avoid mocking on those ejb calls and get some local DB data and prepare the WS response.
-
I came across EJB3Unit. Can someone hint on will be able to replace those of my mock ejb calls with its help.
- In Two ways the xxDAOBean instances be filled via Injection and via simple JNDi lookup
Pseudo code:
com.sample
@.... public class SampleWS{ public String getResponse(String onw, String two){ .... innermethod(); ... } private void innermethod(){ .... SomeObject obj = new SomeObject(); .... } } - In Two ways the xxDAOBean instances be filled via Injection and via simple JNDi lookup
com.sample1 public class Someobject(){ @.. xxDAOBean; public void method1(){ .... List dbList = xxDAOBean.getDBData();..... } }
Aucun commentaire:
Enregistrer un commentaire