Modify spectrum assignment management in PCE
[transportpce.git] / servicehandler / src / test / java / org / opendaylight / transportpce / servicehandler / service / PCEServiceWrapperTest.java
index 064c4cc625d49231a0bb86ce72abf9a0b2977d2d..48f0b32116e5bc4188974a9dd175e7532e8398b0 100644 (file)
@@ -9,10 +9,9 @@ package org.opendaylight.transportpce.servicehandler.service;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
 
 import com.google.common.util.concurrent.ListenableFuture;
-
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -25,19 +24,19 @@ import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev190624.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev190624.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev190624.CancelResourceReserveOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev190624.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev190624.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev190624.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceNotificationTypes;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.CancelResourceReserveOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ServiceNotificationTypes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommon;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInputBuilder;
 
 public class PCEServiceWrapperTest extends AbstractTest {
 
@@ -48,9 +47,11 @@ public class PCEServiceWrapperTest extends AbstractTest {
     @InjectMocks
     private PCEServiceWrapper pceServiceWrapperMock;
 
+    private AutoCloseable closeable;
+
     @Before
-    public void init() throws NoSuchMethodException {
-        MockitoAnnotations.initMocks(this);
+    public void openMocks() throws NoSuchMethodException {
+        closeable = MockitoAnnotations.openMocks(this);
     }
 
     @Test
@@ -62,7 +63,7 @@ public class PCEServiceWrapperTest extends AbstractTest {
                 pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
         Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
                 pceResponse.getConfigurationResponseCommon().getResponseCode());
-        verifyZeroInteractions(this.pathComputationServiceMock);
+        Mockito.verifyNoInteractions(this.pathComputationServiceMock);
     }
 
     @Test
@@ -74,7 +75,7 @@ public class PCEServiceWrapperTest extends AbstractTest {
                 pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
         Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
                 pceResponse.getConfigurationResponseCommon().getResponseCode());
-        verifyZeroInteractions(this.pathComputationServiceMock);
+        Mockito.verifyNoInteractions(this.pathComputationServiceMock);
     }
 
     @Test
@@ -86,7 +87,7 @@ public class PCEServiceWrapperTest extends AbstractTest {
                 pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
         Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
                 pceResponse.getConfigurationResponseCommon().getResponseCode());
-        verifyZeroInteractions(this.pathComputationServiceMock);
+        Mockito.verifyNoInteractions(this.pathComputationServiceMock);
     }
 
 
@@ -98,7 +99,7 @@ public class PCEServiceWrapperTest extends AbstractTest {
                 pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
         Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
                 pceResponse.getConfigurationResponseCommon().getResponseCode());
-        verifyZeroInteractions(this.pathComputationServiceMock);
+        Mockito.verifyNoInteractions(this.pathComputationServiceMock);
     }
 
     @Test
@@ -162,4 +163,8 @@ public class PCEServiceWrapperTest extends AbstractTest {
                 pceResponse.getConfigurationResponseCommon().getResponseMessage());
         verify(this.pathComputationServiceMock).pathComputationRequest((any(PathComputationRequestInput.class)));
     }
+
+    @After public void releaseMocks() throws Exception {
+        closeable.close();
+    }
 }