Increase coverage in workflow.activator package
[appc.git] / appc-dispatcher / appc-workflow-management / appc-workflow-management-core / src / test / java / org / onap / appc / workflow / activator / WorkflowManagerActivatorTest.java
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2019 Ericsson
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.appc.workflow.activator;
23
24 import static org.junit.Assert.assertNotNull;
25 import java.util.concurrent.ScheduledExecutorService;
26 import org.junit.Test;
27 import org.mockito.Mockito;
28 import org.osgi.framework.BundleContext;
29 import org.powermock.reflect.Whitebox;
30
31 public class WorkflowManagerActivatorTest {
32
33     @Test
34     public void testStart() {
35         BundleContext bundleContext = Mockito.mock(BundleContext.class);
36         WorkflowManagerActivator activator = new WorkflowManagerActivator();
37         activator.start(bundleContext);
38         assertNotNull(Whitebox.getInternalState(activator, "executor"));
39     }
40
41     @Test
42     public void testStop() throws Exception {
43         BundleContext bundleContext = Mockito.mock(BundleContext.class);
44         WorkflowManagerActivator activator = new WorkflowManagerActivator();
45         ScheduledExecutorService executor = Mockito.mock(ScheduledExecutorService.class);
46         Whitebox.setInternalState(activator, "executor", executor);
47         activator.stop(bundleContext);
48         Mockito.verify(executor).shutdown();
49     }
50
51 }