Open ghost opened 4 years ago
Since I also think this would be a very useful feature, I hat a take at this. My intermediate result is in https://github.com/fml2/camunda-bpm-mockito/tree/feature/Mock-CallActivity-in-Spring-context.
The usage would be:
new CallActivityMockForSpringContext(processKey, springBeanRegistry).... (all the known methods from CallActivityMock)
Please gurus look at this and tell me whether the approach is a promising one.
For now, I can't figure out how to get a SingletonBeanRegistry (used in my class) given an ApplicationContext (usually available in a spring based test).
I appreciate your contribution. Unfortunately, I was having trouble reviewing this ... I am locally not able to build this ... I guess this is some problem on my machine, please give me a day or two to fix this.
Have you had a chance to look at this?
Following code is not working for Spring tests:
CallActivityMock deployFlowMock = ProcessExpressions.registerCallActivityMock(testDeployFlow).onExecutionAddVariable("var", "val"); deployFlowMock.deploy(processEngine);
As I think it happens because of using different contexts for mocks. I went deep to the mocking code and saw that all stubs are registered withMocks.register(name, instance);
and it puts into static ThreadLocal map. But Spring doesn't see this things. Could you provide an API which will register mocks depends on current context (which we can define with annotation, for example)?