3d2a20b631d51319945f686e5ea70592f5057567
[vid.git] / vid-app-common / src / test / java / org / onap / vid / services / AuditServiceImplTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2018 Nokia. All rights reserved.
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  * ============LICENSE_END=========================================================
19  */
20 package org.onap.vid.services;
21
22 import static org.mockito.Mockito.times;
23 import static org.mockito.Mockito.verify;
24 import static org.mockito.MockitoAnnotations.initMocks;
25
26 import java.util.UUID;
27 import org.glassfish.grizzly.http.util.HttpStatus;
28 import org.mockito.InjectMocks;
29 import org.mockito.Mock;
30 import org.mockito.Mockito;
31 import org.testng.annotations.BeforeClass;
32 import org.testng.annotations.Test;
33
34 public class AuditServiceImplTest {
35   @Mock
36   private AsyncInstantiationBusinessLogic asyncInstantiationBL;
37
38   @InjectMocks
39   private AuditServiceImpl auditService;
40
41   @BeforeClass
42   public void init() {
43     initMocks(this);
44   }
45
46   @Test
47   public void setFailedAuditStatusFromMsoTest() {
48
49     UUID jobUuid = UUID.randomUUID();
50     String requestId = "1";
51     int statusCode = HttpStatus.OK_200.getStatusCode();
52     String msoResponse = "{}";
53
54     auditService.setFailedAuditStatusFromMso(jobUuid, requestId, statusCode, msoResponse);
55
56     verify(asyncInstantiationBL, times(1))
57         .auditMsoStatus(
58             Mockito.any(UUID.class),
59             Mockito.anyString(),
60             Mockito.anyString(),
61             Mockito.anyString());
62   }
63 }