Sho SHIMIZU
Committed by Gerrit Code Review

Prohibit null in instantiation

Change-Id: If5229337d1531eae25cbd2b31ca8e6a117d022f3
......@@ -42,6 +42,9 @@ public final class IntentOperations {
* @param operations list of intent operations
*/
private IntentOperations(List<IntentOperation> operations, ApplicationId appId) {
checkNotNull(operations);
checkNotNull(appId);
this.operations = operations;
this.appId = appId;
}
......
......@@ -20,6 +20,8 @@ import java.util.List;
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 @@ public class IntentOperationsTest {
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 @@ public class IntentOperationsTest {
@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 @@ public class IntentOperationsTest {
@Test
public void testConstruction() {
final IntentOperations operations =
IntentOperations.builder(null) //FIXME
IntentOperations.builder(appId)
.addUpdateOperation(intent.id())
.addWithdrawOperation(intent.id())
.build();
......