2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.dmaap.dbcapi.service;
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;
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;
53 @RunWith(MockitoJUnitRunner.class)
54 public class MirrorMakerServiceTestMockito {
57 private MirrorMakerService service;
60 private CadiFilter cadiFilterMock;
62 private HttpServletRequest servletRequest;
64 private HttpServletResponse servletResponse;
67 private DmaapConfig dmaapConfig;
70 private MirrorMaker mm = new MirrorMaker();
73 public ExpectedException thrown = ExpectedException.none();
76 public void setUp() throws Exception {
81 public void init_normalConstructor() throws Exception {
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);
94 // Todo: learn how to make more tests in Mockito