74f75a8cb2d51d8cb7037d49774a346789b96b47
[dcaegen2/services.git] /
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  slice-analysis-ms
4  *  ================================================================================
5  *   Copyright (C) 2020 Wipro Limited.
6  *   Copyright (C) 2022 Huawei Canada Limited.
7  *   ==============================================================================
8  *     Licensed under the Apache License, Version 2.0 (the "License");
9  *     you may not use this file except in compliance with the License.
10  *     You may obtain a copy of the License at
11  *
12  *          http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *     Unless required by applicable law or agreed to in writing, software
15  *     distributed under the License is distributed on an "AS IS" BASIS,
16  *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *     See the License for the specific language governing permissions and
18  *     limitations under the License.
19  *     ============LICENSE_END=========================================================
20  *
21  *******************************************************************************/
22 package org.onap.slice.analysis.ms.dmaap;
23
24 import com.fasterxml.jackson.databind.ObjectMapper;
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.mockito.InjectMocks;
28 import org.mockito.Mockito;
29 import org.mockito.Spy;
30 import org.springframework.boot.test.context.SpringBootTest;
31 import org.springframework.test.context.junit4.SpringRunner;
32
33 import java.io.IOException;
34 import java.nio.file.Files;
35 import java.nio.file.Paths;
36
37 @RunWith(SpringRunner.class)
38 @SpringBootTest(classes = VesNotificationCallbackTest.class)
39 public class VesNotificationCallbackTest {
40     ObjectMapper obj = new ObjectMapper();
41
42     @Spy
43     @InjectMocks
44     VesNotificationCallback vesNotificationCallback;
45
46     @Test
47     public void initTest() {
48         vesNotificationCallback.init();
49         Mockito.verify(vesNotificationCallback, Mockito.atLeastOnce()).init();
50     }
51
52     @Test
53     public void activateCallBackTest() {
54         String input = null;
55         try {
56             input = new String(Files.readAllBytes(Paths.get("src/test/resources/vesCCVPNNotiModel.json")));
57         } catch (IOException e) {
58             e.printStackTrace();
59         }
60         vesNotificationCallback.activateCallBack(input);
61         Mockito.verify(vesNotificationCallback, Mockito.atLeastOnce()).activateCallBack(Mockito.anyString());
62     }
63 }