2 * Copyright 2017 ZTE Corporation.
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.holmes.rulemgt.send;
20 import org.junit.Test;
21 import org.powermock.api.easymock.PowerMock;
22 import org.powermock.reflect.Whitebox;
24 import java.util.ArrayList;
25 import java.util.List;
27 import static org.hamcrest.core.IsEqual.equalTo;
28 import static org.junit.Assert.assertThat;
30 public class RuleAllocationTest {
32 private RuleAllocation ruleAllocation = new RuleAllocation();
34 public void extendCompareIpTest() throws Exception{
35 List<String> newList = new ArrayList<>();
36 newList.add("10.96.33.34");
37 newList.add("10.74.65.24");
39 List<String> oldList = new ArrayList<>();
40 oldList.add("10.96.33.34");
41 List<String> extendIp = Whitebox.invokeMethod(ruleAllocation,"extendCompareIp",newList,oldList);
43 PowerMock.verifyAll();
45 assertThat(extendIp.get(0),equalTo("10.74.65.24"));
49 public void destroyCompareIpTest() throws Exception{
50 List<String> newList = new ArrayList<>();
51 newList.add("10.96.33.34");
53 List<String> oldList = new ArrayList<>();
54 oldList.add("10.96.33.34");
55 oldList.add("10.74.65.24");
56 List<String> destoryIp = Whitebox.invokeMethod(ruleAllocation,"destroyCompareIp",newList,oldList);
58 PowerMock.verifyAll();
60 assertThat(destoryIp.get(0),equalTo("10.74.65.24"));