Hello,
I am having trouble testing my application using the spring-boot-starter. I would like to have a new deployment for every test method. Therefore I am using the @Deployment
annotation. But this does not work for me.
A test class looks like this:
@RunWith(SpringRunner.class)
@SpringBootTest
@DirtiesContext
public class DecisionComponentTest {
@Autowired
@Rule
public ProcessEngineRule processEngineRule;
@Autowired
private IDecisionComponent decisionComponent;
@Autowired
private IApplicationComponent applicationComponent;
@Autowired
private RuntimeService runtimeService;
@Test
@Deployment(resources = {"application_check.cmmn","document_request_en.bpmn","insurance_application_en.bpmn","risk_check_en.dmn"})
public void testDecideOnApplication() throws ApplicationNotFoundException {
Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().count());
NewApplication newApplication = applicationComponent.createApplication(ExampleApplication.createRiskyApplication());
Assert.assertEquals(1,runtimeService.createProcessInstanceQuery().count());
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();
}
}
The first assertion fails because of the previous tests.
Is there a good example for tests with springboot? Thanks!