d92bd31b680e84d66e5c0781816a29e105de1265
[vfc/nfvo/resmanagement.git] /
1 /*\r
2  * Copyright 2017 Huawei Technologies Co., Ltd.\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 package org.onap.vfc.nfvo.resmanagement.service.rest;\r
18 \r
19 import static org.junit.Assert.assertNotNull;\r
20 \r
21 import javax.servlet.http.HttpServletRequest;\r
22 \r
23 import org.junit.Before;\r
24 import org.junit.Test;\r
25 import org.onap.vfc.nfvo.resmanagement.service.business.impl.LimitsBusinessImpl;\r
26 import org.onap.vfc.nfvo.resmanagement.service.business.inf.LimitsBusiness;\r
27 import org.onap.vfc.nfvo.resmanagement.service.rest.LimitsRoa;\r
28 import org.onap.vfc.nfvo.resmanagement.common.util.restclient.ServiceException;\r
29 import org.springframework.mock.web.MockHttpServletRequest;\r
30 \r
31 import mockit.Mock;\r
32 import mockit.MockUp;\r
33 import net.sf.json.JSONObject;\r
34 \r
35 /**\r
36  * <br>\r
37  * <p>\r
38  * </p>\r
39  * \r
40  * @author\r
41  * @version NFVO 0.5 Feb 9, 2017\r
42  */\r
43 public class LimitsRoaTest {\r
44 \r
45     private LimitsRoa roa;\r
46 \r
47     private LimitsBusiness limitsBusiness;\r
48 \r
49     @Before\r
50     public void setUp() {\r
51         roa = new LimitsRoa();\r
52         limitsBusiness = new LimitsBusinessImpl();\r
53         roa.setLimitsBusiness(limitsBusiness);\r
54     }\r
55 \r
56     @Test\r
57     public void testGetLimitsResource() throws ServiceException {\r
58         new MockUp<LimitsBusinessImpl>() {\r
59 \r
60             @Mock\r
61             public JSONObject getLimits(String vimId) throws ServiceException {\r
62                 return new JSONObject();\r
63             }\r
64         };\r
65         HttpServletRequest context = new MockHttpServletRequest();\r
66         JSONObject result = roa.getLimits(context, "vimId");\r
67         assertNotNull(result);\r
68     }\r
69 }\r