Prohibit null in instantiation
Change-Id: If5229337d1531eae25cbd2b31ca8e6a117d022f3
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentOperations.java b/core/api/src/main/java/org/onosproject/net/intent/IntentOperations.java
index b668fcf..a9b3d44 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentOperations.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentOperations.java
@@ -42,6 +42,9 @@
* @param operations list of intent operations
*/
private IntentOperations(List<IntentOperation> operations, ApplicationId appId) {
+ checkNotNull(operations);
+ checkNotNull(appId);
+
this.operations = operations;
this.appId = appId;
}
diff --git a/core/api/src/test/java/org/onosproject/net/intent/IntentOperationsTest.java b/core/api/src/test/java/org/onosproject/net/intent/IntentOperationsTest.java
index 3fb2ac0..ec0ddae 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/IntentOperationsTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentOperationsTest.java
@@ -20,6 +20,8 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.DefaultApplicationId;
import org.onosproject.core.IdGenerator;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.NetTestTools;
@@ -43,6 +45,8 @@
final TrafficSelector selector = new IntentTestsMocks.MockSelector();
final IntentTestsMocks.MockTreatment treatment = new IntentTestsMocks.MockTreatment();
+ private final ApplicationId appId = new DefaultApplicationId((short) 1, "IntentOperationsTest");
+
private Intent intent;
protected IdGenerator idGenerator = new MockIdGenerator();
@@ -78,15 +82,15 @@
@Test
public void testEquals() {
final IntentOperations operations1 =
- IntentOperations.builder(null) //FIXME null
+ IntentOperations.builder(appId)
.addSubmitOperation(intent)
.build();
final IntentOperations sameAsOperations1 =
- IntentOperations.builder(null) //FIXME null
+ IntentOperations.builder(appId)
.addSubmitOperation(intent)
.build();
final IntentOperations operations2 =
- IntentOperations.builder(null) //FIXME null
+ IntentOperations.builder(appId)
.addReplaceOperation(intent.id(), intent)
.build();
@@ -102,7 +106,7 @@
@Test
public void testConstruction() {
final IntentOperations operations =
- IntentOperations.builder(null) //FIXME
+ IntentOperations.builder(appId)
.addUpdateOperation(intent.id())
.addWithdrawOperation(intent.id())
.build();