Use Collections.emptyList and Collections.emptySet 89/80289/1
authorStephen Kitt <skitt@redhat.com>
Tue, 12 Feb 2019 15:41:53 +0000 (16:41 +0100)
committerStephen Kitt <skitt@redhat.com>
Tue, 12 Feb 2019 15:41:53 +0000 (16:41 +0100)
... instead of the non-generic constants.

Change-Id: I8540db4c2d52185ed0de65eb8b45b75f75cc3f91
Signed-off-by: Stephen Kitt <skitt@redhat.com>
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/GroupingDefinitionDependencySortTest.java
binding/mdsal-binding-generator-util/src/test/java/org/opendaylight/mdsal/binding/model/util/generated/type/builder/EnumerationBuilderImplTest.java
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflectionsTest.java
dom/mdsal-dom-inmemory-datastore/src/test/java/org/opendaylight/mdsal/dom/store/inmemory/ShardSubmitCoordinationTaskTest.java
dom/mdsal-dom-spi/src/test/java/org/opendaylight/mdsal/dom/spi/ForwardingDOMNotificationServiceTest.java
dom/mdsal-dom-spi/src/test/java/org/opendaylight/mdsal/dom/spi/ForwardingDOMRpcProviderServiceTest.java
dom/mdsal-dom-spi/src/test/java/org/opendaylight/mdsal/dom/spi/RegistrationTreeNodeTest.java

index 70a07764421c5134c86a9be713db690566ea0f03..1acfedc7f3a12bb22970db3ce32adc518bb164c4 100644 (file)
@@ -35,38 +35,38 @@ public class GroupingDefinitionDependencySortTest {
         GroupingDefinition grp1 = mock(GroupingDefinition.class);
         doReturn(SchemaPath.create(false, QName.create("", "Cont1"), QName.create("", "Cont2"))).when(grp1).getPath();
         doReturn(QName.create("", "leaf1")).when(grp1).getQName();
-        doReturn(Collections.EMPTY_SET).when(grp1).getUses();
-        doReturn(Collections.EMPTY_SET).when(grp1).getGroupings();
-        doReturn(Collections.EMPTY_SET).when(grp1).getChildNodes();
+        doReturn(Collections.emptySet()).when(grp1).getUses();
+        doReturn(Collections.emptySet()).when(grp1).getGroupings();
+        doReturn(Collections.emptySet()).when(grp1).getChildNodes();
 
         GroupingDefinition grp2 = mock(GroupingDefinition.class);
         doReturn(SchemaPath.create(false, QName.create("", "Cont1"))).when(grp2).getPath();
         doReturn(QName.create("", "leaf2")).when(grp2).getQName();
-        doReturn(Collections.EMPTY_SET).when(grp2).getUses();
-        doReturn(Collections.EMPTY_SET).when(grp2).getGroupings();
-        doReturn(Collections.EMPTY_SET).when(grp2).getChildNodes();
+        doReturn(Collections.emptySet()).when(grp2).getUses();
+        doReturn(Collections.emptySet()).when(grp2).getGroupings();
+        doReturn(Collections.emptySet()).when(grp2).getChildNodes();
 
         GroupingDefinition grp3 = mock(GroupingDefinition.class);
         doReturn(SchemaPath.create(false, QName.create("", "Cont1"), QName.create("", "Cont2"))).when(grp3).getPath();
         doReturn(QName.create("", "leaf3")).when(grp3).getQName();
-        doReturn(Collections.EMPTY_SET).when(grp3).getUses();
-        doReturn(Collections.EMPTY_SET).when(grp3).getGroupings();
-        doReturn(Collections.EMPTY_SET).when(grp3).getChildNodes();
+        doReturn(Collections.emptySet()).when(grp3).getUses();
+        doReturn(Collections.emptySet()).when(grp3).getGroupings();
+        doReturn(Collections.emptySet()).when(grp3).getChildNodes();
 
         GroupingDefinition grp4 = mock(GroupingDefinition.class);
         doReturn(SchemaPath.create(false, QName.create("", "Cont1"), QName.create("", "Cont2"),
             QName.create("", "List1"))).when(grp4).getPath();
         doReturn(QName.create("", "leaf4")).when(grp4).getQName();
-        doReturn(Collections.EMPTY_SET).when(grp4).getUses();
-        doReturn(Collections.EMPTY_SET).when(grp4).getGroupings();
-        doReturn(Collections.EMPTY_SET).when(grp4).getChildNodes();
+        doReturn(Collections.emptySet()).when(grp4).getUses();
+        doReturn(Collections.emptySet()).when(grp4).getGroupings();
+        doReturn(Collections.emptySet()).when(grp4).getChildNodes();
 
         GroupingDefinition grp5 = mock(GroupingDefinition.class);
         doReturn(SchemaPath.create(false, QName.create("", "Cont1"))).when(grp5).getPath();
         doReturn(QName.create("", "leaf5")).when(grp5).getQName();
-        doReturn(Collections.EMPTY_SET).when(grp5).getUses();
-        doReturn(Collections.EMPTY_SET).when(grp5).getGroupings();
-        doReturn(Collections.EMPTY_SET).when(grp5).getChildNodes();
+        doReturn(Collections.emptySet()).when(grp5).getUses();
+        doReturn(Collections.emptySet()).when(grp5).getGroupings();
+        doReturn(Collections.emptySet()).when(grp5).getChildNodes();
 
         unsortedGroupingDefs.add(grp1);
         unsortedGroupingDefs.add(grp1);
index 285cf3244750a4af93c19e5de944599330599155..181a315e494da935f07a6da1dea707ccfdafd91b 100644 (file)
@@ -98,12 +98,12 @@ public class EnumerationBuilderImplTest {
         assertEquals(packageName + '.' + name, enumeration.getFullyQualifiedName());
         assertEquals(reference, enumeration.getReference());
         assertEquals(Collections.singletonList(qname), enumeration.getSchemaPath());
-        assertEquals(Collections.EMPTY_LIST, enumeration.getEnclosedTypes());
-        assertEquals(Collections.EMPTY_LIST, enumeration.getEnumerations());
-        assertEquals(Collections.EMPTY_LIST, enumeration.getMethodDefinitions());
-        assertEquals(Collections.EMPTY_LIST, enumeration.getConstantDefinitions());
-        assertEquals(Collections.EMPTY_LIST, enumeration.getProperties());
-        assertEquals(Collections.EMPTY_LIST, enumeration.getImplements());
+        assertEquals(Collections.emptyList(), enumeration.getEnclosedTypes());
+        assertEquals(Collections.emptyList(), enumeration.getEnumerations());
+        assertEquals(Collections.emptyList(), enumeration.getMethodDefinitions());
+        assertEquals(Collections.emptyList(), enumeration.getConstantDefinitions());
+        assertEquals(Collections.emptyList(), enumeration.getProperties());
+        assertEquals(Collections.emptyList(), enumeration.getImplements());
         assertNotNull(enumeration.getValues());
         assertNotNull(enumeration.getAnnotations());
 
index 9f473a7758425b093eb7d5b289baa4613840f50d..208cd683539d5e1ca8884f0932fb72f6b8e32a4a 100644 (file)
@@ -38,7 +38,7 @@ public class BindingReflectionsTest {
                 BindingReflections.getModelRootPackageName("org.opendaylight.yang.gen.v1.test.rev990939"));
         assertEquals("ModuleInfoClassName should be equal to string", "test.$YangModuleInfoImpl",
                 BindingReflections.getModuleInfoClassName("test"));
-        assertEquals("Module info should be empty Set", Collections.EMPTY_SET,
+        assertEquals("Module info should be empty Set", Collections.emptySet(),
                 BindingReflections.loadModuleInfos());
         assertFalse("Should not be RpcType", BindingReflections.isRpcType(DataObject.class));
         assertFalse("Should not be AugmentationChild", BindingReflections.isAugmentationChild(DataObject.class));
index bc90e3757bf3772c9956d4cc038df7acfb474f0e..76c3a666b4c07712f66a4cd2a409e0676df20ffa 100644 (file)
@@ -33,7 +33,7 @@ public class ShardSubmitCoordinationTaskTest {
     @Test
     public void basicTest() throws Exception {
         final ShardSubmitCoordinationTask shardSubmitCoordinationTask =
-                new ShardSubmitCoordinationTask(DOM_DATA_TREE_IDENTIFIER, Collections.EMPTY_SET, tx);
+                new ShardSubmitCoordinationTask(DOM_DATA_TREE_IDENTIFIER, Collections.emptySet(), tx);
 
         final ShardCanCommitCoordinationTask canCommitCoordinationTask = mock(ShardCanCommitCoordinationTask.class);
         doNothing().when(canCommitCoordinationTask).canCommitBlocking();
index feebbe04c62d99579afe6803fd9e05a579e40256..8aef1b5a42eb46bb0ea549406d733d7942530705 100644 (file)
@@ -34,9 +34,9 @@ public class ForwardingDOMNotificationServiceTest extends ForwardingDOMNotificat
         verify(domNotificationService).registerNotificationListener(domNotificationListener);
 
         doReturn(null).when(domNotificationService).registerNotificationListener(domNotificationListener,
-                Collections.EMPTY_SET);
-        this.registerNotificationListener(domNotificationListener, Collections.EMPTY_SET);
-        verify(domNotificationService).registerNotificationListener(domNotificationListener, Collections.EMPTY_SET);
+                Collections.emptySet());
+        this.registerNotificationListener(domNotificationListener, Collections.emptySet());
+        verify(domNotificationService).registerNotificationListener(domNotificationListener, Collections.emptySet());
     }
 
     @Override
index 5133050a1da9e5cc7961fce04d1424aaa1d4c6a2..44f171566a3c0dab8951acdc76354bd3e7a1c6cd 100644 (file)
@@ -34,9 +34,9 @@ public class ForwardingDOMRpcProviderServiceTest extends ForwardingDOMRpcProvide
         verify(domRpcProviderService).registerRpcImplementation(domRpcImplementation);
 
         doReturn(null).when(domRpcProviderService).registerRpcImplementation(domRpcImplementation,
-                Collections.EMPTY_SET);
-        this.registerRpcImplementation(domRpcImplementation, Collections.EMPTY_SET);
-        verify(domRpcProviderService).registerRpcImplementation(domRpcImplementation, Collections.EMPTY_SET);
+                Collections.emptySet());
+        this.registerRpcImplementation(domRpcImplementation, Collections.emptySet());
+        verify(domRpcProviderService).registerRpcImplementation(domRpcImplementation, Collections.emptySet());
     }
 
     @Override
index 13949374e0647fd628f74c3bb0eb450d61bb19cc..09350a224bd97180dfc702c62fddcd6846159828 100644 (file)
@@ -44,8 +44,8 @@ public class RegistrationTreeNodeTest {
         assertNotNull(registrationTreeNode.getExactChild(pathArgument));
 
         final NodeWithValue<?> nodeWithValue = new NodeWithValue<>(QName.create("", "testNode"), new Object());
-        assertEquals(Collections.EMPTY_LIST, registrationTreeNode.getInexactChildren(nodeWithValue));
-        assertEquals(Collections.EMPTY_LIST, registrationTreeNode.getInexactChildren(pathArgument));
+        assertEquals(Collections.emptyList(), registrationTreeNode.getInexactChildren(nodeWithValue));
+        assertEquals(Collections.emptyList(), registrationTreeNode.getInexactChildren(pathArgument));
 
         final NodeIdentifier nodeWithoutValue = new NodeIdentifier(QName.create("", "testNode"));
         assertNotNull(registrationTreeNode.ensureChild(nodeWithoutValue));