2 * Copyright 2017 Huawei Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.vfc.nfvo.resmanagement.common.util.restclient;
19 import static org.junit.Assert.assertNotNull;
20 import static org.junit.Assert.assertNull;
22 import org.junit.After;
23 import org.junit.AfterClass;
24 import org.junit.Before;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
27 import org.junit.runner.RunWith;
31 import mockit.integration.junit4.JMockit;
41 @RunWith(JMockit.class)
42 public class TestRestfulFactory {
47 * @throws java.lang.Exception
51 public static void setUpBeforeClass() throws Exception {
57 * @throws java.lang.Exception
61 public static void tearDownAfterClass() throws Exception {
67 * @throws java.lang.Exception
71 public void setUp() throws Exception {
77 * @throws java.lang.Exception
81 public void tearDown() throws Exception {
90 public void testGetRestInstance() {
91 Restful instance = RestfulFactory.getRestInstance("https");
93 new MockUp<HttpRest>() {
96 public void initHttpRest(final RestfulOptions option) throws ServiceException {
97 throw new ServiceException();
101 instance = RestfulFactory.getRestInstance("http");
102 assertNotNull(instance);
104 instance = RestfulFactory.getRestInstance("http");
105 assertNotNull(instance);