Eliminate unneeded mocking of static methods 16/74116/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 17 Jul 2018 12:03:14 +0000 (14:03 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 17 Jul 2018 12:56:07 +0000 (14:56 +0200)
We really do not need to override behavior of contructors and
static methods, do not do that.

Change-Id: I6f2b3c31b9a3a17b42d106d97498176a0e955fbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommandTest.java

index 3a10ad1de07ed199a2cf96ac49f58a2b9c466d8e..f833966689e5d2e13b364ccd7a230ce963617788 100644 (file)
@@ -19,7 +19,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import com.google.common.base.Optional;
-import com.google.common.net.InetAddresses;
 import java.net.InetAddress;
 import java.net.NetworkInterface;
 import java.util.ArrayList;
@@ -29,7 +28,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import org.apache.commons.lang3.math.NumberUtils;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -87,7 +85,7 @@ import org.powermock.reflect.Whitebox;
 
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({ TyperUtils.class, OvsdbBridgeUpdateCommand.class, SouthboundUtil.class, InstanceIdentifier.class,
-        SouthboundMapper.class, InetAddresses.class, NumberUtils.class, NetworkInterface.class })
+        SouthboundMapper.class, NetworkInterface.class })
 public class OvsdbBridgeUpdateCommandTest {
     private Map<UUID,Bridge> updatedBridgeRows = new HashMap<>();
     private Map<UUID, Bridge> oldBridgeRows = new HashMap<>();
@@ -460,13 +458,9 @@ public class OvsdbBridgeUpdateCommandTest {
         when(uri.getValue()).thenReturn("tcp:192.168.12.56:6633");
 
         IpAddress bridgeControllerIpAddress = mock(IpAddress.class);
-        PowerMockito.mockStatic(InetAddresses.class);
-        when(InetAddresses.isInetAddress("192.168.12.56")).thenReturn(true);
         PowerMockito.whenNew(IpAddress.class).withAnyArguments().thenReturn(bridgeControllerIpAddress);
 
 
-        PowerMockito.mockStatic(NumberUtils.class);
-        when(NumberUtils.isNumber("6633")).thenReturn(true);
         PortNumber bridgeControllerPortNumber = mock(PortNumber.class);
         PowerMockito.whenNew(PortNumber.class).withAnyArguments().thenReturn(bridgeControllerPortNumber);