private long id;
@Before
public void setup() throws Exception {
tester = new WicketTester();
ApplicationContextMock context = new ApplicationContextMock();
PaxWicketSpringBeanComponentInjector defaultPaxWicketInjector =
new PaxWicketSpringBeanComponentInjector(tester.getApplication(), context);
tester.getApplication().getComponentInstantiationListeners().add(defaultPaxWicketInjector);
ruleManager = mock(RuleManager.class);
Collection<RuleBaseElementId> value = new ArrayList<RuleBaseElementId>();
value.add(new RuleBaseElementId(RuleBaseElementType.Process, "foo"));
when(ruleManager.listAll(RuleBaseElementType.Process)).thenReturn(value);
context.putBean("ruleManager", ruleManager);
id = 0;
workflowService = mock(WorkflowService.class);
when(workflowService.startFlow(anyString())).thenAnswer(new Answer<Long>() {
@Override
public Long answer(InvocationOnMock invocation) throws Throwable {
return id++;
}
});
context.putBean("workflowService", workflowService);
}