Fix various warnings
[netconf.git] / restconf / sal-rest-connector / src / test / java / org / opendaylight / restconf / restful / services / impl / RestconfStreamsSubscriptionServiceImplTest.java
index b441109ec57aebb9601527baee9908517ebd13a0..330d5a24c461ff0b0bfb273741c85d7db0891b0b 100644 (file)
@@ -33,6 +33,8 @@ import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
@@ -54,7 +56,7 @@ import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class RestconfStreamsSubscriptionServiceImplTest {
 
-    private static final String uri = "/restconf/18/data/ietf-restconf-monitoring:restconf-state/streams/stream/"
+    private static final String URI = "/restconf/18/data/ietf-restconf-monitoring:restconf-state/streams/stream/"
             + "toaster:toaster/toasterStatus/datastore=OPERATIONAL/scope=ONE";
     private static Field listenersByStreamName;
 
@@ -80,15 +82,15 @@ public class RestconfStreamsSubscriptionServiceImplTest {
         final DOMDataWriteTransaction wTx = Mockito.mock(DOMDataWriteTransaction.class);
         Mockito.when(domTx.newWriteOnlyTransaction()).thenReturn(wTx);
         final DOMDataReadWriteTransaction rwTx = Mockito.mock(DOMDataReadWriteTransaction.class);
-        final CheckedFuture checkedFuture = Futures.immediateCheckedFuture(true);
+        final CheckedFuture<Boolean, ReadFailedException> checkedFuture = Futures.immediateCheckedFuture(Boolean.TRUE);
         Mockito.when(rwTx.exists(Mockito.any(), Mockito.any())).thenReturn(checkedFuture);
-        final CheckedFuture checkedFutureEmpty = Futures.immediateCheckedFuture("");
+        final CheckedFuture<Void, TransactionCommitFailedException> checkedFutureEmpty =
+                Futures.immediateCheckedFuture(null);
         Mockito.when(rwTx.submit()).thenReturn(checkedFutureEmpty);
         Mockito.when(domTx.newReadWriteTransaction()).thenReturn(rwTx);
-        final CheckedFuture checked = Mockito.mock(CheckedFuture.class);
+        final CheckedFuture<Void, TransactionCommitFailedException> checked = Mockito.mock(CheckedFuture.class);
         Mockito.when(wTx.submit()).thenReturn(checked);
-        final Object valueObj = null;
-        Mockito.when(checked.checkedGet()).thenReturn(valueObj);
+        Mockito.when(checked.checkedGet()).thenReturn(null);
         this.schemaHandler = new SchemaContextHandler(txHandler);
 
         final DOMDataBroker dataBroker = mock(DOMDataBroker.class);
@@ -125,7 +127,7 @@ public class RestconfStreamsSubscriptionServiceImplTest {
 
     @Test
     public void testSubscribeToStream() throws Exception {
-        final UriBuilder uriBuilder = UriBuilder.fromUri(uri);
+        final UriBuilder uriBuilder = UriBuilder.fromUri(URI);
         final ListenerAdapter createListener = Notificator.createListener(
                 IdentifierCodec.deserialize("toaster:toaster/toasterStatus", this.schemaHandler.get()),
                 "data-change-event-subscription/toaster:toaster/toasterStatus/datastore=OPERATIONAL/scope=ONE",
@@ -139,13 +141,13 @@ public class RestconfStreamsSubscriptionServiceImplTest {
                         "data-change-event-subscription/toaster:toaster/toasterStatus/datastore=OPERATIONAL/scope=ONE",
                         this.uriInfo);
         assertEquals(
-                "ws://:8181/data-change-event-subscription/toaster:toaster/toasterStatus/datastore=OPERATIONAL/scope=ONE",
-                response.getNewHeaders().get("Location").toString());
+            "ws://:8181/data-change-event-subscription/toaster:toaster/toasterStatus/datastore=OPERATIONAL/scope=ONE",
+            response.getNewHeaders().get("Location").toString());
     }
 
     @Test(expected = RestconfDocumentedException.class)
     public void testSubscribeToStreamMissingDatastoreInPath() {
-        final UriBuilder uriBuilder = UriBuilder.fromUri(uri);
+        final UriBuilder uriBuilder = UriBuilder.fromUri(URI);
         doReturn(uriBuilder).when(this.uriInfo).getAbsolutePathBuilder();
         final RestconfStreamsSubscriptionServiceImpl streamsSubscriptionService =
                 new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationServiceHandler,
@@ -155,7 +157,7 @@ public class RestconfStreamsSubscriptionServiceImplTest {
 
     @Test(expected = RestconfDocumentedException.class)
     public void testSubscribeToStreamMissingScopeInPath() {
-        final UriBuilder uriBuilder = UriBuilder.fromUri(uri);
+        final UriBuilder uriBuilder = UriBuilder.fromUri(URI);
         doReturn(uriBuilder).when(this.uriInfo).getAbsolutePathBuilder();
         final RestconfStreamsSubscriptionServiceImpl streamsSubscriptionService =
                 new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationServiceHandler,