Fix unit test CS warnings in sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / persisted / CommitTransactionPayloadTest.java
index 0b440c668f435837f2a05f858b44155e45286a92..31dc624a11c6998a48c1a9fd27720212d85c60e5 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
+
 import java.io.IOException;
 import java.util.Collection;
 import org.apache.commons.lang3.SerializationUtils;
@@ -36,7 +37,8 @@ public class CommitTransactionPayloadTest extends AbstractTest {
 
     private DataTreeCandidate candidate;
 
-    private static DataTreeCandidateNode findNode(final Collection<DataTreeCandidateNode> nodes, final PathArgument arg) {
+    private static DataTreeCandidateNode findNode(final Collection<DataTreeCandidateNode> nodes,
+            final PathArgument arg) {
         for (DataTreeCandidateNode node : nodes) {
             if (arg.equals(node.getIdentifier())) {
                 return node;
@@ -68,36 +70,37 @@ public class CommitTransactionPayloadTest extends AbstractTest {
         assertEquals("root type", expRoot.getModificationType(), actRoot.getModificationType());
 
         switch (actRoot.getModificationType()) {
-        case DELETE:
-        case WRITE:
-            assertEquals("root data", expRoot.getDataAfter(), actRoot.getDataAfter());
-            break;
-        case SUBTREE_MODIFIED:
-            assertChildrenEquals(expRoot.getChildNodes(), actRoot.getChildNodes());
-            break;
-        default:
-            fail("Unexpect root type " + actRoot.getModificationType());
-            break;
+            case DELETE:
+            case WRITE:
+                assertEquals("root data", expRoot.getDataAfter(), actRoot.getDataAfter());
+                break;
+            case SUBTREE_MODIFIED:
+                assertChildrenEquals(expRoot.getChildNodes(), actRoot.getChildNodes());
+                break;
+            default:
+                fail("Unexpect root type " + actRoot.getModificationType());
+                break;
         }
 
         assertCandidateNodeEquals(expected.getRootNode(), actual.getRootNode());
     }
 
-    private static void assertCandidateNodeEquals(final DataTreeCandidateNode expected, final DataTreeCandidateNode actual) {
+    private static void assertCandidateNodeEquals(final DataTreeCandidateNode expected,
+            final DataTreeCandidateNode actual) {
         assertEquals("child type", expected.getModificationType(), actual.getModificationType());
         assertEquals("child identifier", expected.getIdentifier(), actual.getIdentifier());
 
         switch (actual.getModificationType()) {
-        case DELETE:
-        case WRITE:
-            assertEquals("child data", expected.getDataAfter(), actual.getDataAfter());
-            break;
-        case SUBTREE_MODIFIED:
-            assertChildrenEquals(expected.getChildNodes(), actual.getChildNodes());
-            break;
-        default:
-            fail("Unexpect root type " + actual.getModificationType());
-            break;
+            case DELETE:
+            case WRITE:
+                assertEquals("child data", expected.getDataAfter(), actual.getDataAfter());
+                break;
+            case SUBTREE_MODIFIED:
+                assertChildrenEquals(expected.getChildNodes(), actual.getChildNodes());
+                break;
+            default:
+                fail("Unexpect root type " + actual.getModificationType());
+                break;
         }
     }
 
@@ -105,9 +108,9 @@ public class CommitTransactionPayloadTest extends AbstractTest {
     public void setUp() {
         setUpStatic();
         final YangInstanceIdentifier writePath = TestModel.TEST_PATH;
-        final NormalizedNode<?, ?> writeData = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
-                new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).
-                withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build();
+        final NormalizedNode<?, ?> writeData = ImmutableContainerNodeBuilder.create()
+                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
+                .withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build();
         candidate = DataTreeCandidates.fromNormalizedNode(writePath, writeData);
     }
 
@@ -136,10 +139,10 @@ public class CommitTransactionPayloadTest extends AbstractTest {
         YangInstanceIdentifier leafSetEntryPath = YangInstanceIdentifier.builder(TestModel.TEST_PATH).node(LEAF_SET)
                 .node(entryPathArg).build();
 
-        NormalizedNode<?, ?> leafSetEntryNode = Builders.leafSetEntryBuilder().
-                withNodeIdentifier(entryPathArg).withValue("one").build();
+        NormalizedNode<?, ?> leafSetEntryNode = Builders.leafSetEntryBuilder().withNodeIdentifier(entryPathArg)
+                .withValue("one").build();
 
-        DataTreeCandidate candidate = DataTreeCandidates.fromNormalizedNode(leafSetEntryPath, leafSetEntryNode);
+        candidate = DataTreeCandidates.fromNormalizedNode(leafSetEntryPath, leafSetEntryNode);
         CommitTransactionPayload payload = CommitTransactionPayload.create(nextTransactionId(), candidate);
         assertCandidateEquals(candidate, payload.getCandidate().getValue());
     }
@@ -150,12 +153,12 @@ public class CommitTransactionPayloadTest extends AbstractTest {
         YangInstanceIdentifier.NodeWithValue entryPathArg = new YangInstanceIdentifier.NodeWithValue(LEAF_SET, "one");
         YangInstanceIdentifier leafSetPath = YangInstanceIdentifier.builder(TestModel.TEST_PATH).node(LEAF_SET).build();
 
-        LeafSetEntryNode leafSetEntryNode = Builders.leafSetEntryBuilder().
-                withNodeIdentifier(entryPathArg).withValue("one").build();
+        LeafSetEntryNode leafSetEntryNode = Builders.leafSetEntryBuilder().withNodeIdentifier(entryPathArg)
+                .withValue("one").build();
         NormalizedNode<?, ?> leafSetNode = Builders.leafSetBuilder().withNodeIdentifier(
                 new YangInstanceIdentifier.NodeIdentifier(LEAF_SET)).withChild(leafSetEntryNode).build();
 
-        DataTreeCandidate candidate = DataTreeCandidates.fromNormalizedNode(leafSetPath, leafSetNode);
+        candidate = DataTreeCandidates.fromNormalizedNode(leafSetPath, leafSetNode);
         CommitTransactionPayload payload = CommitTransactionPayload.create(nextTransactionId(), candidate);
         assertCandidateEquals(candidate, payload.getCandidate().getValue());
     }
@@ -166,23 +169,24 @@ public class CommitTransactionPayloadTest extends AbstractTest {
         YangInstanceIdentifier.NodeWithValue entryPathArg = new YangInstanceIdentifier.NodeWithValue(LEAF_SET, "one");
         YangInstanceIdentifier leafSetPath = YangInstanceIdentifier.builder(TestModel.TEST_PATH).node(LEAF_SET).build();
 
-        LeafSetEntryNode leafSetEntryNode = Builders.leafSetEntryBuilder().
-                withNodeIdentifier(entryPathArg).withValue("one").build();
+        LeafSetEntryNode leafSetEntryNode = Builders.leafSetEntryBuilder().withNodeIdentifier(entryPathArg)
+                .withValue("one").build();
         NormalizedNode<?, ?> leafSetNode = Builders.orderedLeafSetBuilder().withNodeIdentifier(
                 new YangInstanceIdentifier.NodeIdentifier(LEAF_SET)).withChild(leafSetEntryNode).build();
 
-        DataTreeCandidate candidate = DataTreeCandidates.fromNormalizedNode(leafSetPath, leafSetNode);
+        candidate = DataTreeCandidates.fromNormalizedNode(leafSetPath, leafSetNode);
         CommitTransactionPayload payload = CommitTransactionPayload.create(nextTransactionId(), candidate);
         assertCandidateEquals(candidate, payload.getCandidate().getValue());
     }
 
     @Test
     public void testLeafNodeCandidate() throws Exception {
-        YangInstanceIdentifier leafPath = YangInstanceIdentifier.builder(TestModel.TEST_PATH).node(TestModel.DESC_QNAME).build();
+        YangInstanceIdentifier leafPath = YangInstanceIdentifier.builder(TestModel.TEST_PATH)
+                .node(TestModel.DESC_QNAME).build();
         LeafNode<Object> leafNode = Builders.leafBuilder().withNodeIdentifier(
                 new YangInstanceIdentifier.NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
 
-        DataTreeCandidate candidate = DataTreeCandidates.fromNormalizedNode(leafPath, leafNode);
+        candidate = DataTreeCandidates.fromNormalizedNode(leafPath, leafNode);
         CommitTransactionPayload payload = CommitTransactionPayload.create(nextTransactionId(), candidate);
         assertCandidateEquals(candidate, payload.getCandidate().getValue());
     }