Alfresco过程服务-单元/集成测试

时间:2020-08-12 04:45:34

标签: junit integration-testing alfresco activiti alfresco-process-services

我正在使用Alfresco Process Service进行工作流管理。

我创建了自定义工作流,在其中使用服务“任务操作”。 我已经为该服务任务创建了JavaDelegate,并且正在运行。 我的问题如何为JavaDelegate创建Junit /集成测试。

我正在附上我尝试过的代码。

出现依赖注入错误。

首先,它给出了EndPointService依赖项注入的错误,但是在@Bean的帮助下,我能够解决该问题,但是它再次给出了EndPointService内部使用的依赖项错误。

@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 {   
    }
}

0 个答案:

没有答案