I am following APS Junit for testing aps custom logic.
I have JavaDelegate and signal class.
I have custom endpoint which is calling third party api to fetch data, for that How Can I create UNIT Test case? without using Integration Testing and Using Mockito.
Any help would be appreciated.
Thanks&Regards,
Laxmi Mounika Boorela
I would just mock a sample response into mockito unit test case. In mockito framework its all about mocking, so if a service is expecting some response from third party or from a web url, we just mock a sample response to valiate all positive/negative test scenarios.
Example:
public void testBlah() throws Exception { ....... ...... final String endPoint = "https://example.com/getJson/xyzabc123"; when(blahService.getJson(endPoint)) .thenReturn(new JSONObject(getMockedResourceAsString("/files/test-sample.json"))); ..... ..... }
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.