AnsweredAssumed Answered

How to write junit test with existing spring configuration

Question asked by yongqiang on Jun 30, 2015
Latest reply on Jun 30, 2015 by jbarrez
Greeting Everyone,

I get a project which use activiti for years. There are a lot beans defined in spring xml files need to be loaded for process flow. Now, I like to build junit test for some process flows.

From what I understand, ActivitiRule will only look up activiti.cfg.xml by default. It will not load bean from spring xml files.

Are there any configuration I can let ActivitRule to understand definition from Spring XML?

Further, I tried approach like below

@ContextConfiguration(locations = "classpath:spring/applicationContext*.xml")

It does help to load bean but I counter issue such as "Caused by: org.h2.jdbc.JdbcSQLException: Table "ACT_HI_PROCINST" already exists; SQL statement:"

I did some research, people say we can clean h2 db before test. But question is, how?

Any advice, please.