From bf984d781cc89b6cce2ab0756f7e274b8e686c52 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 18 Jul 2018 00:16:44 +0200 Subject: [PATCH] Move unchecked warnings Tagging specific statements is better here, as there are only two. It makes the method better protected and the code is more readable ('here I need to do a cast, which is deemed unsafe'). Change-Id: I7cb8fcfbe1080e6e869fff1de4ba227f84a78eeb Signed-off-by: Robert Varga --- .../org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java index 44a35ec89..85751cdac 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java @@ -107,7 +107,6 @@ public class SouthboundUtilTest { assertEquals("Incorrect Optional object received", node, SouthboundUtil.readNode(transaction, connectionIid)); } - @SuppressWarnings("unchecked") @Test public void testGetLocalControllerHostIpAddress() throws Exception { @@ -116,12 +115,14 @@ public class SouthboundUtilTest { when(NetworkInterface.getNetworkInterfaces()).thenReturn(null); assertNull(SouthboundUtil.getLocalControllerHostIpAddress()); + @SuppressWarnings("unchecked") Enumeration ifaces = mock(Enumeration.class); when(NetworkInterface.getNetworkInterfaces()).thenReturn(ifaces); when(ifaces.hasMoreElements()).thenReturn(true).thenReturn(false); NetworkInterface iface = PowerMockito.mock(NetworkInterface.class); when(ifaces.nextElement()).thenReturn(iface); + @SuppressWarnings("unchecked") Enumeration inetAddrs = mock(Enumeration.class); when(iface.getInetAddresses()).thenReturn(inetAddrs); when(inetAddrs.hasMoreElements()).thenReturn(true).thenReturn(false); -- 2.36.6