2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * =============================================================================
9 * Copyright (C) 2018 Nokia
10 * =============================================================================
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 * ============LICENSE_END=========================================================
26 package org.onap.appc.dg.util.impl;
28 import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
29 import static org.mockito.Mockito.verifyZeroInteractions;
31 import java.util.HashMap;
33 import org.junit.Before;
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36 import org.mockito.Mock;
37 import org.mockito.runners.MockitoJUnitRunner;
38 import org.onap.appc.dg.util.UpgradeStubNode;
39 import org.onap.appc.exceptions.APPCException;
40 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
42 @RunWith(MockitoJUnitRunner.class)
43 public class UpgradeStubNodeImplTest {
46 private SvcLogicContext svcLogicContext;
48 private UpgradeStubNode upgradeStubNode;
52 upgradeStubNode = new UpgradeStubNodeImpl();
56 public void handleUpgradeStub_shouldCompleteSuccessfully_whenFailureIndicatorIsNull() throws APPCException {
57 Map<String, String> params = new HashMap<>();
58 upgradeStubNode.handleUpgradeStub(params, svcLogicContext);
59 verifyZeroInteractions(svcLogicContext);
63 public void handleUpgradeStub_shouldCompleteSuccessfully_whenFailureIndicatorIsFalse() throws APPCException {
65 Map<String, String> params = new HashMap<>();
66 params.put("failureIndicator", "false");
68 upgradeStubNode.handleUpgradeStub(params, svcLogicContext);
70 verifyZeroInteractions(svcLogicContext);
74 public void handleUpgradeStub_shouldThrowAPPCException_whenFailureIndicatorIsTrue() throws APPCException {
76 Map<String, String> params = new HashMap<>();
77 params.put("failureIndicator", "true");
79 assertThatExceptionOfType(APPCException.class)
80 .isThrownBy(() -> upgradeStubNode.handleUpgradeStub(params, svcLogicContext));
81 verifyZeroInteractions(svcLogicContext);