JavaDelegate - Unit Test

Showing results for 
Search instead for 
Did you mean: 

JavaDelegate - Unit Test

I have created service task and I am using JavaDelegate for backend process.

Process working fine.

I have created test case using alfresco-process-services-unit-testing.

Normal Way it is working fine but when I Autowire any service,It is giving error.

First it was giving error of no bean type found of EndPointService. After that I have injected that class in @Configuration, now it is giving error of no bean found  which is used inside EndPointService.

Anyone have idea how can I Mock all the required dependency?

Code : 

public class SearchRecord implements JavaDelegate {

	private EndpointService endPointService;

public class SearchRecordTest {

	static class ContextConfiguration {
		public SearchRecord searchRecord() {
			return new SearchRecord();
public EndPointService endPointServiceImpl()
{ return new EndPointServiceImpl();
} } @InjectMocks @Spy private static SearchRecord searchRecord; @Mock private DelegateExecution execution; @Before public void initMocks() { MockitoAnnotations.initMocks(this); } @Test public void test() throws Exception { } }

@cjose @openpj  Help would be appreciated.