5beadc61149bce4a6d958f4252b8bdaa0f08a1d0
[dmaap/buscontroller.git] / dmaap-bc / src / test / java / org / onap / dmaap / dbcapi / service / MirrorMakerServiceTestMockito.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.onap.dmaap
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. 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.dmaap.dbcapi.service;
21
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertFalse;
24 import static org.junit.Assert.assertNotNull;
25 import static org.junit.Assert.assertNull;
26 import static org.junit.Assert.assertTrue;
27 import static org.mockito.Matchers.anyString;
28 import static org.mockito.Matchers.eq;
29 import static org.mockito.Mockito.doReturn;
30 import static org.mockito.Mockito.verify;
31 import static org.mockito.Mockito.verifyNoMoreInteractions;
32 import static org.mockito.Mockito.verifyZeroInteractions;
33
34 import java.io.PrintWriter;
35 import java.io.StringWriter;
36 import javax.servlet.FilterChain;
37 import javax.servlet.FilterConfig;
38 import javax.servlet.ServletException;
39 import javax.servlet.http.HttpServletRequest;
40 import javax.servlet.http.HttpServletResponse;
41 import org.junit.Before;
42 import org.junit.Rule;
43 import org.junit.Test;
44 import org.junit.rules.ExpectedException;
45 import org.junit.runner.RunWith;
46 import org.mockito.Mock;
47 import org.mockito.Spy;
48 import org.mockito.runners.MockitoJUnitRunner;
49 import org.onap.aaf.cadi.filter.CadiFilter;
50 import org.onap.dmaap.dbcapi.model.MirrorMaker;
51 import org.onap.dmaap.dbcapi.util.DmaapConfig;
52
53 @RunWith(MockitoJUnitRunner.class)
54 public class MirrorMakerServiceTestMockito {
55
56     @Spy
57     private MirrorMakerService service;
58
59     @Mock
60     private CadiFilter cadiFilterMock;
61     @Mock
62     private HttpServletRequest servletRequest;
63     @Mock
64     private HttpServletResponse servletResponse;
65    
66     @Mock
67     private DmaapConfig dmaapConfig;
68     
69     @Mock
70     private MirrorMaker mm = new MirrorMaker();
71
72     @Rule
73     public ExpectedException thrown = ExpectedException.none();
74
75     @Before
76     public void setUp() throws Exception {
77    
78     }
79
80     @Test
81     public void init_normalConstructor() throws Exception {
82         //given
83         
84
85         //when
86         
87
88         //then
89         assertEquals( MirrorMakerService.getProvUserPwd(), MirrorMakerService.PROV_PWD_DEFAULT);
90         assertEquals( MirrorMakerService.getDefaultConsumerPort(), MirrorMakerService.TARGET_REPLICATION_PORT_DEFAULT);
91         assertEquals( MirrorMakerService.getDefaultProducerPort(), MirrorMakerService.SOURCE_REPLICATION_PORT_DEFAULT);
92     }
93
94   // Todo: learn how to make more tests in Mockito
95
96
97 }