Cleaning up intent tests setup/teardown to avoid cascading failures
with respect to binding ID generator.

Change-Id: Ia4778f16ff5a3ecb26062e7d7b2c36493081140d
diff --git a/web/api/src/test/java/org/onosproject/rest/resources/IntentsResourceTest.java b/web/api/src/test/java/org/onosproject/rest/resources/IntentsResourceTest.java
index efabf66f..e041962 100644
--- a/web/api/src/test/java/org/onosproject/rest/resources/IntentsResourceTest.java
+++ b/web/api/src/test/java/org/onosproject/rest/resources/IntentsResourceTest.java
@@ -35,7 +35,6 @@
 import org.onosproject.core.CoreService;
 import org.onosproject.core.DefaultApplicationId;
 import org.onosproject.core.GroupId;
-import org.onosproject.core.IdGenerator;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.NetworkResource;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -56,6 +55,7 @@
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.IntentState;
 import org.onosproject.net.intent.Key;
+import org.onosproject.net.intent.MockIdGenerator;
 
 import javax.ws.rs.NotFoundException;
 import javax.ws.rs.client.Entity;
@@ -76,7 +76,6 @@
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 import static org.onosproject.net.intent.IntentTestsMocks.MockIntent;
-import static org.onosproject.net.intent.MockIdGenerator.bindNewGenerator;
 
 /**
  * Unit tests for Intents REST APIs.
@@ -101,7 +100,6 @@
     final HashSet<Intent> intents = new HashSet<>();
     final List<org.onosproject.net.intent.Intent> installableIntents = new ArrayList<>();
     private static final ApplicationId APP_ID = new DefaultApplicationId(1, "test");
-    private IdGenerator mockGenerator;
 
     final DeviceId deviceId1 = DeviceId.deviceId("1");
 
@@ -698,7 +696,7 @@
 
         BaseResource.setServiceDirectory(testDirectory);
 
-        bindNewGenerator();
+        MockIdGenerator.cleanBind();
     }
 
     /**
@@ -706,6 +704,7 @@
      */
     @After
     public void tearDownTest() {
+        MockIdGenerator.unbind();
         verify(mockIntentService);
     }