JavaDelegate - Unit Test
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 04:37 AM
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 :
@Component("searchRecord") public class SearchRecord implements JavaDelegate { @Autowired private EndpointService endPointService; } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class SearchRecordTest { @Configuration static class ContextConfiguration { @Bean public SearchRecord searchRecord() { return new SearchRecord(); }
@Bean
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 { } }
Labels:
- Labels:
-
Alfresco Process Services
0 REPLIES 0
