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.
16 package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient;
18 import static org.junit.Assert.assertNotNull;
19 import static org.junit.Assert.assertNull;
21 import org.junit.Test;
22 import org.junit.runner.RunWith;
24 import mockit.integration.junit4.JMockit;
25 @RunWith(JMockit.class)
26 public class ServiceExceptionTest {
30 ServiceException serviceException = new ServiceException();
31 ServiceException serviceWithThrowable = new ServiceException("id",new Throwable());
32 ServiceException serviceWithThrowableMessage = new ServiceException("id","message",new Throwable());
34 ServiceException serviceWithMessage = new ServiceException("message");
35 ServiceException serviceWithID = new ServiceException("id","message");
36 ServiceException serviceWithHttpCode = new ServiceException("id",200);
37 ServiceException serviceWithHttpCodeAndMessage = new ServiceException(200,"message");
38 ServiceException serviceWithexceptionArgs = new ServiceException("id",200,new ExceptionArgs());
39 ServiceException serviceWithMessageThowable =new ServiceException("id","message","args","args");
40 ServiceException serviceWithThowableAndArgs =new ServiceException("id","message",new Throwable(),"args");
41 assertNotNull(serviceWithThowableAndArgs.getArgs());
42 assertNotNull(serviceWithID.getId());
43 assertNotNull(serviceWithexceptionArgs.getExceptionArgs());
44 assertNotNull(serviceWithThowableAndArgs.getArgs());