1 package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
3 import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
4 import static org.mockito.Matchers.any;
5 import static org.mockito.Mockito.doThrow;
7 import java.io.IOException;
9 import org.camunda.bpm.engine.delegate.BpmnError;
10 import org.camunda.bpm.engine.runtime.ProcessInstance;
11 import org.junit.Test;
12 import org.onap.so.bpmn.BaseBPMNTest;
13 import org.onap.so.bpmn.common.BuildingBlockExecution;
17 public class GenericVnfHealthCheckBBTest extends BaseBPMNTest {
20 public void sunnyDayGenericVnfHealthCheckBBTest() throws InterruptedException, IOException {
22 ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
23 assertThat(pi).isNotNull();
24 assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck",
25 "Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
26 assertThat(pi).isEnded();
30 public void genericVnfHealthCheckBBExceptionTest() throws Exception {
31 doThrow(new BpmnError("7000", "TESTING ERRORS")).when(genericVnfHealthCheck).setParamsForGenericVnfHealthCheck(any(BuildingBlockExecution.class));
32 ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
33 assertThat(pi).isNotNull();
34 assertThat(pi).isStarted()
35 .hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck")
36 .hasNotPassed("Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
37 assertThat(pi).isEnded();