Bug 8153: Enforce check-style rules for netconf - mdsal-netconf-notification 14/55214/5
authormatus.kubica <matus.kubica@pantheon.tech>
Wed, 19 Apr 2017 11:58:01 +0000 (13:58 +0200)
committerTomas Cere <tcere@cisco.com>
Thu, 27 Apr 2017 12:58:36 +0000 (12:58 +0000)
    Organize Imports for Checkstyle compliance.
    Checkstyle compliance: line length.
    Checkstyle compliance: various types of small changes.
    Checkstyle compliant Exception handling.
    Checkstyle final clean up & enforcement.
    Add the fail on violation flag into the pom.xml .

Change-Id: I4d2d61f049132abad779b20c6720b002f0cfba4a
Signed-off-by: matus.kubica <matus.kubica@pantheon.tech>
netconf/mdsal-netconf-notification/pom.xml
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducer.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListener.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducer.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationService.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationServiceFactory.java
netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducerTest.java
netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriterTest.java
netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListenerTest.java
netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducerTest.java

index af94c6e66de8ed165b4bac073f63500ef3fb94f8..b616011db18ef754560b7ba9e818fb043629c0e7 100644 (file)
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>
index 35f5c805aecbfdf39cfdafb19db7751989439b13..c3c2caafcc23ea56bc49bed13c123101f91562f9 100644 (file)
@@ -28,6 +28,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.not
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.changed.by.parms.changed.by.server.or.user.ServerBuilder;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -38,6 +40,7 @@ public final class CapabilityChangeNotificationProducer extends OperationalDatas
 
     private static final InstanceIdentifier<Capabilities> CAPABILITIES_INSTANCE_IDENTIFIER =
             InstanceIdentifier.create(NetconfState.class).child(Capabilities.class);
+    private static final Logger LOG = LoggerFactory.getLogger(CapabilityChangeNotificationProducer.class);
 
     private final BaseNotificationPublisherRegistration baseNotificationPublisherRegistration;
     private final ListenerRegistration capabilityChangeListenerRegistration;
@@ -58,8 +61,10 @@ public final class CapabilityChangeNotificationProducer extends OperationalDatas
                 case WRITE: {
                     final Capabilities dataAfter = rootNode.getDataAfter();
                     final Capabilities dataBefore = rootNode.getDataBefore();
-                    final Set<Uri> before = dataBefore != null ? ImmutableSet.copyOf(dataBefore.getCapability()) : Collections.emptySet();
-                    final Set<Uri> after = dataAfter != null ? ImmutableSet.copyOf(dataAfter.getCapability()) : Collections.emptySet();
+                    final Set<Uri> before = dataBefore != null ? ImmutableSet.copyOf(dataBefore.getCapability()) :
+                            Collections.emptySet();
+                    final Set<Uri> after = dataAfter != null ? ImmutableSet.copyOf(dataAfter.getCapability()) :
+                            Collections.emptySet();
                     final Set<Uri> added = Sets.difference(after, before);
                     final Set<Uri> removed = Sets.difference(before, after);
                     publishNotification(added, removed);
@@ -73,6 +78,8 @@ public final class CapabilityChangeNotificationProducer extends OperationalDatas
                     }
                     break;
                 }
+                default:
+                    LOG.debug("Received intentionally unhandled type: {}.", modificationType);
             }
         }
 
@@ -80,7 +87,8 @@ public final class CapabilityChangeNotificationProducer extends OperationalDatas
 
     private void publishNotification(Set<Uri> added, Set<Uri> removed) {
         final NetconfCapabilityChangeBuilder netconfCapabilityChangeBuilder = new NetconfCapabilityChangeBuilder();
-        netconfCapabilityChangeBuilder.setChangedBy(new ChangedByBuilder().setServerOrUser(new ServerBuilder().setServer(true).build()).build());
+        netconfCapabilityChangeBuilder.setChangedBy(new ChangedByBuilder().setServerOrUser(new ServerBuilder()
+                .setServer(true).build()).build());
         netconfCapabilityChangeBuilder.setAddedCapability(ImmutableList.copyOf(added));
         netconfCapabilityChangeBuilder.setDeletedCapability(ImmutableList.copyOf(removed));
         // TODO modified should be computed ... but why ?
@@ -89,7 +97,7 @@ public final class CapabilityChangeNotificationProducer extends OperationalDatas
     }
 
     /**
-     * Invoke by blueprint
+     * Invoked by blueprint.
      */
     public void close() {
         if (baseNotificationPublisherRegistration != null) {
index 5ffe2c9ecddf383f51a37d44e4a141d5ceaac899..1535b987f983eb718aee58984bc0511d78f1d755 100644 (file)
@@ -30,7 +30,8 @@ import org.slf4j.LoggerFactory;
  * Listens on changes in netconf notification stream availability and writes
  * changes to the data store.
  */
-public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNotificationCollector.NetconfNotificationStreamListener {
+public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNotificationCollector
+        .NetconfNotificationStreamListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(NotificationToMdsalWriter.class);
 
@@ -52,7 +53,7 @@ public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNo
 
         Futures.addCallback(submit, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(Void aVoid) {
+            public void onSuccess(Void avoid) {
                 LOG.debug("Streams cleared successfully");
             }
 
@@ -66,7 +67,7 @@ public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNo
     }
 
     /**
-     * Invoke by blueprint
+     * Invoked by blueprint.
      */
     public void start() {
         notificationRegistration = netconfNotificationCollector.registerStreamListener(this);
@@ -76,8 +77,8 @@ public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNo
     public void onStreamRegistered(Stream stream) {
         final WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
 
-        final InstanceIdentifier streamIdentifier = InstanceIdentifier.create(Netconf.class).child(Streams.class).
-                builder().child(Stream.class, stream.getKey()).build();
+        final InstanceIdentifier streamIdentifier = InstanceIdentifier.create(Netconf.class).child(Streams.class)
+                .builder().child(Stream.class, stream.getKey()).build();
         tx.merge(LogicalDatastoreType.OPERATIONAL, streamIdentifier, stream, true);
 
         try {
@@ -93,8 +94,8 @@ public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNo
         final WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
 
         final StreamKey streamKey = new StreamKey(stream);
-        final InstanceIdentifier streamIdentifier = InstanceIdentifier.create(Netconf.class).child(Streams.class).
-                builder().child(Stream.class, streamKey).build();
+        final InstanceIdentifier streamIdentifier = InstanceIdentifier.create(Netconf.class).child(Streams.class)
+                .builder().child(Stream.class, streamKey).build();
 
         tx.delete(LogicalDatastoreType.OPERATIONAL, streamIdentifier);
 
index dc05778611de2354c98e7a783926586385064363..b3c54bde4981a75d00bbc85456f054f89172019e 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Abstract base class for subclasses, which want to listen for changes on specified subtree in operational datastore.
+ *
  * @param <T> data object class
  */
 abstract class OperationalDatastoreListener<T extends DataObject> implements DataTreeChangeListener<T> {
@@ -24,14 +25,17 @@ abstract class OperationalDatastoreListener<T extends DataObject> implements Dat
     private final InstanceIdentifier<T> instanceIdentifier;
 
     /**
-     * @param instanceIdentifier instance identifier of subtree, on which this instance should listen on changes
+     * Constructor.
+     *
+     * @param instanceIdentifier instance identifier of subtree, on which this instance should listen on changes.
      */
     OperationalDatastoreListener(InstanceIdentifier<T> instanceIdentifier) {
         this.instanceIdentifier = instanceIdentifier;
     }
 
     /**
-     * Registers this instance as OPERATIONAL datastore listener via provided dataBroker
+     * Registers this instance as OPERATIONAL datastore listener via provided dataBroker.
+     *
      * @param dataBroker data broker
      * @return listener registration
      */
index f8d1b0edb6e7bb82f33f806daa419c1315fbe5f2..08bd188a974e09e58f127a72049f65b0b0b7d87d 100644 (file)
@@ -26,14 +26,18 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.not
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * Listens on changes in NetconfState/Sessions/Session datastore and publishes them
+ * Listens on changes in NetconfState/Sessions/Session datastore and publishes them.
  */
 public class SessionNotificationProducer extends OperationalDatastoreListener<Session> {
 
     private static final InstanceIdentifier<Session> SESSION_INSTANCE_IDENTIFIER =
             InstanceIdentifier.create(NetconfState.class).child(Sessions.class).child(Session.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SessionNotificationProducer.class);
+
 
     private final BaseNotificationPublisherRegistration baseNotificationPublisherRegistration;
     private final ListenerRegistration sessionListenerRegistration;
@@ -46,6 +50,7 @@ public class SessionNotificationProducer extends OperationalDatastoreListener<Se
         this.sessionListenerRegistration = registerOnChanges(dataBroker);
     }
 
+    @SuppressWarnings("checkstyle:MissingSwitchDefault")
     @Override
     public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Session>> changes) {
         for (DataTreeModification<Session> change : changes) {
@@ -64,6 +69,8 @@ public class SessionNotificationProducer extends OperationalDatastoreListener<Se
                         publishEndedSession(removed);
                     }
                     break;
+                default:
+                    LOG.debug("Received intentionally unhandled type: {}.", modificationType);
             }
         }
     }
@@ -92,7 +99,7 @@ public class SessionNotificationProducer extends OperationalDatastoreListener<Se
 
 
     /**
-     * Invoke by blueprint
+     * Invoked by blueprint.
      */
     public void close() {
         if (baseNotificationPublisherRegistration != null) {
index f008884f5627803c81b302fe4f32bfda3e1cfe1e..fef38d1c90c64ca128173cede26c16ed4b04c895 100644 (file)
@@ -18,8 +18,10 @@ import org.opendaylight.netconf.notifications.impl.ops.CreateSubscription;
 public class NetconfNotificationOperationService implements NetconfOperationService {
     private final Set<NetconfOperation> netconfOperations;
 
-    public NetconfNotificationOperationService(String netconfSessionIdForReporting, NetconfNotificationRegistry netconfNotificationRegistry) {
-        this.netconfOperations = Collections.singleton(new CreateSubscription(netconfSessionIdForReporting, netconfNotificationRegistry));
+    public NetconfNotificationOperationService(String netconfSessionIdForReporting, NetconfNotificationRegistry
+            netconfNotificationRegistry) {
+        this.netconfOperations = Collections.singleton(new CreateSubscription(netconfSessionIdForReporting,
+                netconfNotificationRegistry));
     }
 
 
@@ -28,6 +30,7 @@ public class NetconfNotificationOperationService implements NetconfOperationServ
         return netconfOperations;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public void close() {
         for (NetconfOperation netconfOperation : netconfOperations) {
index 41ae98e1a2822505f79cc314a11964784bcfa53d..b6c92d0a852f2dec5f569d2d32985e66f35f423f 100644 (file)
@@ -23,8 +23,9 @@ public class NetconfNotificationOperationServiceFactory implements NetconfOperat
     private final NetconfNotificationRegistry netconfNotificationRegistry;
     private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
 
-    public NetconfNotificationOperationServiceFactory(final NetconfNotificationRegistry netconfNotificationRegistry,
-                                                      final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener) {
+    public NetconfNotificationOperationServiceFactory(
+            final NetconfNotificationRegistry netconfNotificationRegistry,
+            final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener) {
         this.netconfNotificationRegistry = netconfNotificationRegistry;
         this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
 
@@ -34,8 +35,10 @@ public class NetconfNotificationOperationServiceFactory implements NetconfOperat
     @Override
     public Set<Capability> getCapabilities() {
         // TODO
-        // No capabilities exposed to prevent clashes with schemas from config-netconf-connector (it exposes all the schemas)
-        // If the schemas exposed by config-netconf-connector are filtered, this class would expose monitoring related models
+        // No capabilities exposed to prevent clashes with schemas from
+        // config-netconf-connector (it exposes all the schemas)
+        // If the schemas exposed by config-netconf-connector are filtered,
+        // this class would expose monitoring related models
         return Collections.emptySet();
     }
 
index 2f9ae073c1818403f890d72d7762b7f863f756af..549c0ce2e1504aa7f4a97ac477bdc789f862c9d3 100644 (file)
@@ -60,19 +60,24 @@ public class CapabilityChangeNotificationProducerTest {
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
 
-        doReturn(listenerRegistration).when(dataBroker).registerDataTreeChangeListener(any(DataTreeIdentifier.class), any(DataTreeChangeListener.class));
+        doReturn(listenerRegistration).when(dataBroker).registerDataTreeChangeListener(any(DataTreeIdentifier.class),
+                any(DataTreeChangeListener.class));
 
         doNothing().when(baseNotificationPublisherRegistration).onCapabilityChanged(any(NetconfCapabilityChange.class));
 
-        doReturn(baseNotificationPublisherRegistration).when(netconfNotificationCollector).registerBaseNotificationPublisher();
+        doReturn(baseNotificationPublisherRegistration).when(netconfNotificationCollector)
+                .registerBaseNotificationPublisher();
 
-        capabilityChangeNotificationProducer = new CapabilityChangeNotificationProducer(netconfNotificationCollector, dataBroker);
+        capabilityChangeNotificationProducer = new CapabilityChangeNotificationProducer(netconfNotificationCollector,
+                dataBroker);
     }
 
     @Test
     public void testOnDataChangedCreate() {
-        final InstanceIdentifier capabilitiesIdentifier = InstanceIdentifier.create(NetconfState.class).child(Capabilities.class).builder().build();
-        final List<Uri> newCapabilitiesList = Lists.newArrayList(new Uri("newCapability"), new Uri("createdCapability"));
+        final InstanceIdentifier capabilitiesIdentifier =
+                InstanceIdentifier.create(NetconfState.class).child(Capabilities.class).builder().build();
+        final List<Uri> newCapabilitiesList =
+                Lists.newArrayList(new Uri("newCapability"), new Uri("createdCapability"));
         Capabilities newCapabilities = new CapabilitiesBuilder().setCapability(newCapabilitiesList).build();
         Map<InstanceIdentifier<?>, DataObject> createdData = Maps.newHashMap();
         createdData.put(capabilitiesIdentifier, newCapabilities);
@@ -82,12 +87,16 @@ public class CapabilityChangeNotificationProducerTest {
 
     @Test
     public void testOnDataChangedUpdate() {
-        final List<Uri> originalCapabilitiesList = Lists.newArrayList(new Uri("originalCapability"), new Uri("anotherOriginalCapability"));
-        final List<Uri> updatedCapabilitiesList = Lists.newArrayList(new Uri("originalCapability"), new Uri("newCapability"));
+        final List<Uri> originalCapabilitiesList =
+                Lists.newArrayList(new Uri("originalCapability"), new Uri("anotherOriginalCapability"));
+        final List<Uri> updatedCapabilitiesList =
+                Lists.newArrayList(new Uri("originalCapability"), new Uri("newCapability"));
         Capabilities originalCapabilities = new CapabilitiesBuilder().setCapability(originalCapabilitiesList).build();
         Capabilities updatedCapabilities = new CapabilitiesBuilder().setCapability(updatedCapabilitiesList).build();
-        verifyDataTreeChange(DataObjectModification.ModificationType.WRITE, originalCapabilities, updatedCapabilities, changedCapabilitesFrom(
-                Lists.newArrayList(new Uri("newCapability")), Lists.newArrayList(new Uri("anotherOriginalCapability"))));
+        verifyDataTreeChange(DataObjectModification.ModificationType.WRITE, originalCapabilities,
+                updatedCapabilities, changedCapabilitesFrom(
+                Lists.newArrayList(new Uri("newCapability")), Lists.newArrayList(new Uri("anotherOriginalCapability")
+                        )));
     }
 
     @Test
index 316d56c0d1f18b22010928ba501caadaaf5b4581..072fc3657ab0b31cd9e9a03b3ac7ba78fa23e191 100644 (file)
@@ -55,8 +55,8 @@ public class NotificationToMdsalWriterTest {
         doReturn(dataBroker).when(session).getSALService(DataBroker.class);
 
         WriteTransaction tx = mock(WriteTransaction.class);
-        doNothing().when(tx).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)
-                any(DataObject.class), anyBoolean());
+        doNothing().when(tx).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
+                any(DataObject.class), anyBoolean());
         doNothing().when(tx).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
         doReturn(Futures.immediateCheckedFuture(null)).when(tx).submit();
         doReturn(tx).when(dataBroker).newWriteOnlyTransaction();
@@ -74,7 +74,8 @@ public class NotificationToMdsalWriterTest {
 
         writer.onStreamRegistered(testStream);
 
-        verify(dataBroker.newWriteOnlyTransaction()).merge(LogicalDatastoreType.OPERATIONAL, streamIdentifier, testStream, true);
+        verify(dataBroker.newWriteOnlyTransaction()).merge(LogicalDatastoreType.OPERATIONAL, streamIdentifier,
+                testStream, true);
 
         writer.onStreamUnregistered(testStreamName);
 
@@ -82,7 +83,7 @@ public class NotificationToMdsalWriterTest {
     }
 
     @Test
-    public void testClose(){
+    public void testClose() {
         doNothing().when(notificationRegistration).close();
 
         final InstanceIdentifier streamIdentifier = InstanceIdentifier.create(Netconf.class);
index 6e87cb8468d8e173f9792ae4f10362355c3be11d..74957359bc66c54873d9e87e4060f35b62765d32 100644 (file)
@@ -37,12 +37,13 @@ public class OperationalDatastoreListenerTest {
     }
 
     @Test
-    public void testDataStoreListener(){
+    public void testDataStoreListener() {
         final InstanceIdentifier<DataObject> instanceIdentifier = InstanceIdentifier.create(DataObject.class);
         final DataTreeIdentifier<DataObject> testId =
                 new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
 
-        final OperationalDatastoreListener<DataObject> op = new OperationalDatastoreListener<DataObject>(instanceIdentifier) {
+        final OperationalDatastoreListener<DataObject> op =
+                new OperationalDatastoreListener<DataObject>(instanceIdentifier) {
             @Override
             public void onDataTreeChanged(@Nonnull Collection collection) {
             }
index cedebb4eeaca0fd97f22d416449b46bf62d80853..aa83c680ff8f4ebdc63af1b89961e0ae6d2296e3 100644 (file)
@@ -36,9 +36,13 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.not
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.ZeroBasedCounter32;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class SessionNotificationProducerTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(SessionNotificationProducerTest.class);
+
     private SessionNotificationProducer publisher;
 
     @Mock
@@ -55,7 +59,8 @@ public class SessionNotificationProducerTest {
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
 
-        doReturn(listenerRegistration).when(dataBroker).registerDataTreeChangeListener(any(DataTreeIdentifier.class), any(DataTreeChangeListener.class));
+        doReturn(listenerRegistration).when(dataBroker).registerDataTreeChangeListener(any(DataTreeIdentifier.class),
+                any(DataTreeChangeListener.class));
 
         doNothing().when(registration).onCapabilityChanged(any(NetconfCapabilityChange.class));
         doNothing().when(registration).onSessionStarted(any());
@@ -69,7 +74,8 @@ public class SessionNotificationProducerTest {
     @Test
     public void testOnDataChangedSessionCreated() throws Exception {
         final Session session = createSession(1);
-        final DataTreeModification<Session> treeChange = getTreeModification(session, DataObjectModification.ModificationType.WRITE);
+        final DataTreeModification<Session> treeChange = getTreeModification(session, DataObjectModification
+                .ModificationType.WRITE);
         publisher.onDataTreeChanged(Collections.singleton(treeChange));
         ArgumentCaptor<NetconfSessionStart> captor = ArgumentCaptor.forClass(NetconfSessionStart.class);
         verify(registration).onSessionStarted(captor.capture());
@@ -98,7 +104,8 @@ public class SessionNotificationProducerTest {
     @Test
     public void testOnDataChangedSessionDeleted() throws Exception {
         final Session session = createSession(1);
-        final DataTreeModification<Session> data = getTreeModification(session, DataObjectModification.ModificationType.DELETE);
+        final DataTreeModification<Session> data = getTreeModification(session, DataObjectModification
+                .ModificationType.DELETE);
         publisher.onDataTreeChanged(Collections.singleton(data));
         ArgumentCaptor<NetconfSessionEnd> captor = ArgumentCaptor.forClass(NetconfSessionEnd.class);
         verify(registration).onSessionEnded(captor.capture());
@@ -122,7 +129,8 @@ public class SessionNotificationProducerTest {
     }
 
     @SuppressWarnings("unchecked")
-    private DataTreeModification<Session> getTreeModification(Session session, DataObjectModification.ModificationType type) {
+    private DataTreeModification<Session> getTreeModification(Session session, DataObjectModification
+            .ModificationType type) {
         final DataTreeModification<Session> treeChange = mock(DataTreeModification.class);
         final DataObjectModification<Session> changeObject = mock(DataObjectModification.class);
         switch (type) {
@@ -133,6 +141,8 @@ public class SessionNotificationProducerTest {
             case DELETE:
                 doReturn(session).when(changeObject).getDataBefore();
                 break;
+            default:
+                LOG.debug("Received intentionally unhandled type: {}.", type);
         }
         doReturn(type).when(changeObject).getModificationType();
         doReturn(changeObject).when(treeChange).getRootNode();