@Test public void should_lazy_initialize_engine() { delegate = new ProcessEngineDelegate(processEngineConfiguration, false); assertThat(delegate, notNullValue()); assertThat(delegate.isInitialized(), is(false)); delegate.initProcessEngine(); assertThat(delegate.isInitialized(), is(true)); }
@Test public void should_fail_to_close_more_than_once() { final ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine(); delegate = new ProcessEngineDelegate(processEngine); delegate.closeProcessEngine(); thrown.expect(IllegalStateException.class); delegate.closeProcessEngine(); }
@Test public void should_fail_to_re_initialize_engine_after_close_when_configuration() { final ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine(); delegate = new ProcessEngineDelegate(processEngine); delegate.closeProcessEngine(); assertThat(delegate.isInitialized(), is(false)); delegate.initProcessEngine(); assertThat(delegate.isInitialized(), is(true)); }
@Test public void should_initialize_with_prebuild_engine() { final ProcessEngine preBuildProcessEngine = processEngineConfiguration.buildProcessEngine(); delegate = new ProcessEngineDelegate(preBuildProcessEngine); assertThat(delegate.isInitialized(), is(true)); }
@After public void cleanUpJustInCase() { if (delegate != null && delegate.getProcessEngine() != null) { delegate.getProcessEngine().close(); } }