Checkstyle fixes for tests

- Fixed some checkstyle errors which seemed easier to fix.

Change-Id: I9dadd2e8f98b560fadcc2b704ac52ff8f8b93913
diff --git a/src/test/java/net/onrc/onos/apps/proxyarp/ArpCacheTest.java b/src/test/java/net/onrc/onos/apps/proxyarp/ArpCacheTest.java
index 34d4bc4..1668e4d 100644
--- a/src/test/java/net/onrc/onos/apps/proxyarp/ArpCacheTest.java
+++ b/src/test/java/net/onrc/onos/apps/proxyarp/ArpCacheTest.java
@@ -18,7 +18,7 @@
 
 public class ArpCacheTest {
     ArpCache arpCache;
-    InetAddress ip, ip2;
+    InetAddress ip1, ip2;
     MACAddress mac, mac2;
     Map<InetAddress, MACAddress> map;
 
@@ -27,7 +27,7 @@
         arpCache = new ArpCache();
         arpCache.setArpEntryTimeoutConfig(1000);
         mac = MACAddress.valueOf("00:01:02:03:04:05");
-        ip = InetAddress.getByAddress(new byte[]{10, 0, 0, 1});
+        ip1 = InetAddress.getByAddress(new byte[]{10, 0, 0, 1});
         mac2 = MACAddress.valueOf("00:01:02:03:04:06");
         ip2 = InetAddress.getByAddress(new byte[]{10, 0, 0, 2});
     }
@@ -51,24 +51,24 @@
     @Test
     public void testUpdate() {
         map = new HashMap<InetAddress, MACAddress>();
-        arpCache.update(ip, mac);
-        map.put(ip, mac);
+        arpCache.update(ip1, mac);
+        map.put(ip1, mac);
         arpCache.update(ip2, mac2);
         map.put(ip2, mac2);
-        assertEquals(mac, arpCache.lookup(ip));
+        assertEquals(mac, arpCache.lookup(ip1));
     }
 
     @Test
     public void testRemove() {
         testUpdate();
-        arpCache.remove(ip);
-        assertNull(arpCache.lookup(ip));
+        arpCache.remove(ip1);
+        assertNull(arpCache.lookup(ip1));
     }
 
     @Test
     public void testGetMappings() {
         testUpdate();
-        for(String macStr :arpCache.getMappings()) {
+        for (String macStr :arpCache.getMappings()) {
             assertNotNull(macStr);
         }
     }
@@ -85,7 +85,7 @@
 
         assertNotNull(arpCache.getExpiredArpCacheIps());
         assertEquals(map.size(), arpCache.getExpiredArpCacheIps().size());
-        for(InetAddress ip : arpCache.getExpiredArpCacheIps()) {
+        for (InetAddress ip : arpCache.getExpiredArpCacheIps()) {
            assertTrue(map.containsKey(ip));
         }
     }
diff --git a/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java b/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
index 7453a68..e34bde9 100644
--- a/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
+++ b/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
@@ -27,7 +27,6 @@
 import net.onrc.onos.core.packet.ARP;
 import net.onrc.onos.core.packet.Ethernet;
 import net.onrc.onos.core.packet.IPv4;
-import net.onrc.onos.core.packetservice.SinglePacketOutNotification;
 import net.onrc.onos.core.topology.Device;
 import net.onrc.onos.core.topology.ITopologyService;
 import net.onrc.onos.core.topology.Topology;
@@ -44,7 +43,7 @@
 import org.powermock.modules.junit4.PowerMockRunner;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({ProxyArpManager.class, ArpCache.class})
+@PrepareForTest({ ProxyArpManager.class, ArpCache.class })
 public class ProxyArpManagerTest {
     String defaultStrAgingMsec = "60000";
     String defaultStrCleanupMsec = "60000";
@@ -59,7 +58,7 @@
     ITopologyService topologyService;
     IOnosDeviceService onosDeviceService;
     IPacketService packetService;
-    Map<String, String> config;
+    Map<String, String> configMap;
 
     String srcStrMac, dstStrMac, cachedStrMac1, cachedStrMac2, srcStrIp, dstStrIp, cachedStrIp1, cachedStrIp2;
     byte[] srcByteMac, dstByteMac;
@@ -117,7 +116,7 @@
         } catch (UnknownHostException e) {
             e.printStackTrace();
         }
-        sw1Dpid = 1l;
+        sw1Dpid = 1L;
         sw1Inport = 1;
         sw1Outport = 2;
         vlanId = 1;
@@ -201,7 +200,7 @@
                 + " : VALID");
 
         arpManager = new ProxyArpManager();
-        config = new HashMap<String, String>();
+        configMap = new HashMap<String, String>();
     }
 
     private void makeMock() {
@@ -227,8 +226,8 @@
     }
 
     private void prepareExpectForGeneral() {
-        EasyMock.expect(inPort1.getNumber()).andReturn((long)sw1Inport).anyTimes();
-        EasyMock.expect(outPort1.getNumber()).andReturn((long)sw1Outport).anyTimes();
+        EasyMock.expect(inPort1.getNumber()).andReturn((long) sw1Inport).anyTimes();
+        EasyMock.expect(outPort1.getNumber()).andReturn((long) sw1Outport).anyTimes();
         EasyMock.expect(outPort1.getOutgoingLink()).andReturn(null).anyTimes();
         EasyMock.expect(outPort1.getIncomingLink()).andReturn(null).anyTimes();
         EasyMock.expect(outPort1.getSwitch()).andReturn(sw1).anyTimes();
@@ -259,8 +258,8 @@
         packetService.registerPacketListener(arpManager);
         EasyMock.expectLastCall();
         EasyMock.expect(topologyService.getTopology()).andReturn(topology);
-        EasyMock.expect(datagridService.addListener((String)EasyMock.anyObject(), EasyMock.isA(IEventChannelListener.class),
-                (Class)EasyMock.anyObject(), (Class)EasyMock.anyObject())).andReturn(eg).anyTimes();
+        EasyMock.expect(datagridService.addListener((String) EasyMock.anyObject(), EasyMock.isA(IEventChannelListener.class),
+                (Class) EasyMock.anyObject(), (Class) EasyMock.anyObject())).andReturn(eg).anyTimes();
         List<ArpCacheNotification> list = new ArrayList<ArpCacheNotification>();
         EasyMock.expect(eg.getAllEntries()).andReturn(list);
     }
@@ -309,9 +308,9 @@
     public void testConfigTime() {
         String strAgingMsec = "10000";
         String strCleanupMsec = "10000";
-        config.put("agingmsec", strAgingMsec);
-        config.put("cleanupmsec", strCleanupMsec);
-        EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
+        configMap.put("agingmsec", strAgingMsec);
+        configMap.put("cleanupmsec", strCleanupMsec);
+        EasyMock.expect(context.getConfigParams(arpManager)).andReturn(configMap);
 
         EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
                 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
@@ -344,7 +343,7 @@
         arpManager.init(context);
         arpManager.startUp(context);
         List<String> list = arpManager.getMappings();
-        for(String str : list) {
+        for (String str : list) {
             assertTrue(arpCacheComparisonList.contains(str));
         }
     }
@@ -429,7 +428,7 @@
         topology.releaseReadLock();
         EasyMock.expectLastCall();
         EasyMock.expect(dev1.getAttachmentPoints()).andReturn(portList);
-        eg.addTransientEntry(EasyMock.anyLong(), (SinglePacketOutNotification)EasyMock.anyObject());
+        eg.addTransientEntry(EasyMock.anyLong(), EasyMock.anyObject());
         EasyMock.expectLastCall();
 
         EasyMock.replay(context, configInfoService, restApiService, floodligthProviderService,
diff --git a/src/test/java/net/onrc/onos/apps/sdnip/PatriciaTreeTest.java b/src/test/java/net/onrc/onos/apps/sdnip/PatriciaTreeTest.java
index 686971e..c5138c1 100644
--- a/src/test/java/net/onrc/onos/apps/sdnip/PatriciaTreeTest.java
+++ b/src/test/java/net/onrc/onos/apps/sdnip/PatriciaTreeTest.java
@@ -48,7 +48,7 @@
 
     @Test
     public void testPut() {
-        IPatriciaTree<RibEntry> ptree = new PatriciaTree<RibEntry>(32);
+        ptree = new PatriciaTree<RibEntry>(32);
 
         Prefix p1 = new Prefix("192.168.240.0", 20);
         RibEntry r1 = new RibEntry("192.168.10.101", "192.168.60.2");
diff --git a/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java b/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java
index d1e5f9a..a000564 100644
--- a/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java
+++ b/src/test/java/net/onrc/onos/apps/sdnip/PrefixTest.java
@@ -69,9 +69,9 @@
     public void testPrefixReturnsSame() {
         //Create a prefix of all 1s for each prefix length.
         //Check that Prefix doesn't mangle it
-        int MAX_PREFIX_LENGTH = 32;
+        final int MAX_PREFIX_LENGTH = 32;
         for (int prefixLength = 1; prefixLength <= MAX_PREFIX_LENGTH; prefixLength++) {
-            byte address[] = new byte[MAX_PREFIX_LENGTH / Byte.SIZE];
+            byte[] address = new byte[MAX_PREFIX_LENGTH / Byte.SIZE];
 
             int lastByte = (prefixLength - 1) / Byte.SIZE;
             int lastBit = (prefixLength - 1) % Byte.SIZE;
diff --git a/src/test/java/net/onrc/onos/apps/sdnip/PtreeTest.java b/src/test/java/net/onrc/onos/apps/sdnip/PtreeTest.java
index 4fac2f2..ad36811 100644
--- a/src/test/java/net/onrc/onos/apps/sdnip/PtreeTest.java
+++ b/src/test/java/net/onrc/onos/apps/sdnip/PtreeTest.java
@@ -182,8 +182,8 @@
     @Test
     public void testMisc() {
         int bitIndex = -1;
-        int index = (int) (bitIndex / Byte.SIZE);
-        int bit = (int) (bitIndex % Byte.SIZE);
+        int index = bitIndex / Byte.SIZE;
+        int bit = bitIndex % Byte.SIZE;
 
         log.debug("index {} bit {}", index, bit);
         log.debug("percent {}", 1 % 8);
@@ -199,7 +199,7 @@
     }
 
     @Test
-    public void testIteration() {
+    public void testIteration() throws UnknownHostException {
         Iterator<IPatriciaTree.Entry<RibEntry>> it = ooPtree.iterator();
 
         while (it.hasNext()) {
@@ -207,13 +207,9 @@
             log.debug("PatriciaTree prefix {} \t {}", entry.getPrefix(), entry.getPrefix().printAsBits());
         }
 
-        try {
-            PtreeNode node;
-            for (node = ptree.begin(); node != null; node = ptree.next(node)) {
-                log.debug("Ptree prefix {}/{}", InetAddress.getByAddress(node.key).getHostAddress(), node.keyBits);
-            }
-        } catch (UnknownHostException e) {
-
+        PtreeNode node;
+        for (node = ptree.begin(); node != null; node = ptree.next(node)) {
+            log.debug("Ptree prefix {}/{}", InetAddress.getByAddress(node.key).getHostAddress(), node.keyBits);
         }
     }