fa56c2416dcf4c771649412f695e88f73b3c70c4
[vfc/nfvo/resmanagement.git] /
1 /*
2  * Copyright 2017 Huawei Technologies Co., Ltd.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.openo.nfvo.resmanagement.service.dao.impl;
18
19 import static org.junit.Assert.*;
20
21 import org.junit.Test;
22 import org.openo.baseservice.remoteservice.exception.ServiceException;
23 import org.openo.nfvo.resmanagement.service.entity.LocationEntity;
24 import org.openo.nfvo.resmanagement.service.entity.NetworkEntity;
25 import org.openo.nfvo.resmanagement.service.mapper.LocationMapper;
26
27 import mockit.Mock;
28 import mockit.MockUp;
29
30 public class LocationDaoImplTest {
31     LocationMapper mapper;
32     @Test
33     public void testaddHost() throws ServiceException {
34
35         new MockUp<AbstractDao>() {
36
37             @Mock
38              public <T> T getMapperManager(Class<T> type) {
39                 return (T) mapper;
40
41             }
42         };
43         LocationDaoImpl impl = new LocationDaoImpl();
44         LocationEntity locationEntity =new LocationEntity();
45         locationEntity.setId("locationEntity");
46
47
48     }
49
50     @Test
51     public void testaddLocationSelective() throws ServiceException {
52
53         new MockUp<AbstractDao>() {
54
55             @Mock
56              public <T> T getMapperManager(Class<T> type) {
57                 return (T) mapper;
58
59             }
60         };
61         LocationDaoImpl impl = new LocationDaoImpl();
62         LocationEntity locationEntity =new LocationEntity();
63         locationEntity.setId("1");
64
65
66     }
67
68     @Test
69     public void testupdateNetwork() throws ServiceException {
70
71             new MockUp<AbstractDao>() {
72
73             @Mock
74              public <T> T getMapperManager(Class<T> type) {
75                 return (T) mapper;
76
77             }
78         };
79         NetworkDaoImpl impl = new NetworkDaoImpl();
80         NetworkEntity networkEntity =new NetworkEntity();
81         networkEntity.setId("1");
82
83     }
84
85 }