Fix some compiler warnings about unchecked types
Change-Id: Ib360aa05fd0e194a65bbc0b624447e4bdb4ced93
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
index f85a89d..24c69d2 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
@@ -241,6 +241,16 @@
return new BgpRouteEntryAndPeerMatcher(bgpRouteEntry);
}
+ @SuppressWarnings("unchecked")
+ private Dictionary<String, String>
+ getDictionaryMock(ComponentContext componentContext) {
+ Dictionary<String, String> dictionary = createMock(Dictionary.class);
+ expect(dictionary.get("bgpPort")).andReturn("0");
+ replay(dictionary);
+ expect(componentContext.getProperties()).andReturn(dictionary);
+ return dictionary;
+ }
+
@Before
public void setUp() throws Exception {
peer1 = new TestBgpPeer(BGP_PEER1_ID);
@@ -258,10 +268,7 @@
bgpSessionManager = new BgpSessionManager();
// NOTE: We use port 0 to bind on any available port
ComponentContext componentContext = createMock(ComponentContext.class);
- Dictionary<String, String> dictionary = createMock(Dictionary.class);
- expect(dictionary.get("bgpPort")).andReturn("0");
- replay(dictionary);
- expect(componentContext.getProperties()).andReturn(dictionary);
+ Dictionary<String, String> dictionary = getDictionaryMock(componentContext);
replay(componentContext);
bgpSessionManager.activate(componentContext);
bgpSessionManager.start(dummyRouteListener);
@@ -288,7 +295,7 @@
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
- asPathShort = new BgpRouteEntry.AsPath(new ArrayList(pathSegments));
+ asPathShort = new BgpRouteEntry.AsPath(new ArrayList<>(pathSegments));
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();