Add missing dependency during test run

- Inject LinkCollectionIntentCompiler dependency on JUnitTest run
- Add sanity check on LabelAllocator construction

Change-Id: Ic7f1a8a85f5dcc85c9ffe1d2c25c2dc509e08d30
diff --git a/core/net/src/main/java/org/onosproject/net/resource/impl/LabelAllocator.java b/core/net/src/main/java/org/onosproject/net/resource/impl/LabelAllocator.java
index 4086768..c150e26 100644
--- a/core/net/src/main/java/org/onosproject/net/resource/impl/LabelAllocator.java
+++ b/core/net/src/main/java/org/onosproject/net/resource/impl/LabelAllocator.java
@@ -35,6 +35,8 @@
 import org.onosproject.net.resource.ResourceService;
 import org.onosproject.net.resource.Resources;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -71,7 +73,7 @@
      * @param rs the resource service
      */
     public LabelAllocator(ResourceService rs) {
-        this.resourceService = rs;
+        this.resourceService = checkNotNull(rs);
         this.labelSelection = this.getLabelSelection(Behavior.RANDOM);
     }
 
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java
index 45e8485..fd2e32e 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompilerTest.java
@@ -41,6 +41,7 @@
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentExtensionService;
 import org.onosproject.net.intent.LinkCollectionIntent;
+import org.onosproject.net.resource.MockResourceService;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -100,6 +101,7 @@
         registrator.activate();
 
         sut.registrator = registrator;
+        sut.resourceService = new MockResourceService();
 
         LinkCollectionCompiler.optimize = false;
         LinkCollectionCompiler.copyTtl = false;