2 * Copyright 2016 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.
18 package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient;
20 import static org.junit.Assert.*;
22 import java.io.IOException;
24 import org.junit.Test;
26 import net.sf.json.JSONException;
28 public class RestfulConfigureTest {
31 public void testRestfulConfigure() {
32 RestfulConfigure rc = new RestfulConfigure();
37 public void testRestfulConfigureStringNoFilePath() {
38 RestfulConfigure rc = new RestfulConfigure("");
39 RestfulOptions rp = rc.getOptions();
44 public void testRestfulConfigureStringNoFileExist() {
45 RestfulConfigure rc = new RestfulConfigure("C:/Users/Public/Desktop");
46 RestfulOptions rp = rc.getOptions();
51 public void testRestfulConfigureString() {
52 RestfulConfigure rc = new RestfulConfigure("src/test/resources/Check7.txt");
53 RestfulOptions rp = rc.getOptions();
58 public void testRestfulConfigureStringNoFile() {
59 RestfulConfigure rc = new RestfulConfigure("src/test/resources/Check1.txt");
60 RestfulOptions rp = rc.getOptions();
65 public void testRestfulConfigureStringWrongFile() {
66 RestfulConfigure rc = new RestfulConfigure("src/test/resources/Check2.txt");
67 RestfulOptions rp = rc.getOptions();
72 public void testRestfulConfigureStringEmptyFile() {
73 RestfulConfigure rc = new RestfulConfigure("src/test/resources/Check3.txt");
74 RestfulOptions rp = rc.getOptions();
78 public void testRestfulConfigureStringNoHostFile() {
79 RestfulConfigure rc = new RestfulConfigure("src/test/resources/Check4.txt");
80 RestfulOptions rp = rc.getOptions();
83 @Test(expected=JSONException.class)
84 public void testRestfulConfigureStringZeroFile() throws IOException {
85 RestfulConfigure rc = new RestfulConfigure("src/test/resources/Check5.txt");
89 public void testRestfulConfigureStringClose() {
90 RestfulConfigure rc = new RestfulConfigure("src/test/resources/Check6.txt");