cancel
Showing results for 
Search instead for 
Did you mean: 

ExceptionInInitializerError when attempting to create Unit Test

wesg
Champ in-the-making
Champ in-the-making
The following code throws an java.lang.ExceptionInInitializerError exception on the first line of code within the test method.  Any suggestions on how to resolve this issue or direction is appreciated.  I verified that the class activitiRule instance is not null.  I also tested that the value returned from the getRuntimeService method doesn't result in null.  The problem appears to be when it calls the startProcessInstanceByKey method, the last line of the stack trace is: "at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.<init>(DefaultSingletonBeanRegistry.java:86)".


public class MyUnitTest
{
   @Rule
   public ActivitiRule activitiRule = new ActivitiRule();

   @Test
   @Deployment( resources = {"VacationRequest.bpmn20.xml"} )
   public void test()
   {
      ProcessInstance processInstance = activitiRule.getRuntimeService().startProcessInstanceByKey("vacationRequest");
      assertNotNull(processInstance);
      Task task = activitiRule.getTaskService().createTaskQuery().singleResult();
      assertEquals( "Activiti is awesome", task.getName() );
   }
}
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

could you create jUnit test and provide a link to git hub?
https://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin