Refactor the code so the populateSubnet is only called once per nexthop movement

Also make sure FPM and STATIC get processed first in this case

Change-Id: I9235b1c47452dc639ccef488442739bee302adbe
diff --git a/app/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java b/app/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java
index ade5d0c..2d365a2 100644
--- a/app/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java
+++ b/app/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java
@@ -18,6 +18,7 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import org.junit.Before;
@@ -407,6 +408,8 @@
         ROUTE_STORE.put(P1, Sets.newHashSet(RR3));
 
         reset(srManager.deviceConfiguration);
+        expect(srManager.deviceConfiguration.getBatchedSubnets(H3D.id()))
+                .andReturn(Lists.<Set<IpPrefix>>newArrayList(Sets.newHashSet(P1)));
         srManager.deviceConfiguration.removeSubnet(CP2, P1);
         expectLastCall().once();
         replay(srManager.deviceConfiguration);
@@ -455,6 +458,8 @@
         testDualHomedSingleLocationFail();
 
         reset(srManager.deviceConfiguration);
+        expect(srManager.deviceConfiguration.getBatchedSubnets(H3S.id()))
+                .andReturn(Lists.<Set<IpPrefix>>newArrayList(Sets.newHashSet(P1)));
         srManager.deviceConfiguration.addSubnet(CP2, P1);
         expectLastCall().once();
         replay(srManager.deviceConfiguration);