config-api: use lambdas 64/57164/2
authorStephen Kitt <skitt@redhat.com>
Tue, 16 May 2017 15:48:01 +0000 (17:48 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 16 May 2017 23:17:49 +0000 (23:17 +0000)
This series of patches uses lambdas instead of anonymous classes for
functional interfaces when possible. Lambdas are replaced with method
references when appropriate.

Change-Id: I77f590e1e5b5548cb472268fb469b5bbf7cd268d
Signed-off-by: Stephen Kitt <skitt@redhat.com>
opendaylight/config/config-api/src/test/java/org/opendaylight/controller/config/api/jmx/ObjectNameUtilTest.java

index a9be8e9..5727651 100644 (file)
@@ -126,26 +126,12 @@ public class ObjectNameUtilTest {
     public void testChecks() throws Exception {
         final ObjectName on = ObjectNameUtil.createON("customDomain", ObjectNameUtil.TYPE_KEY, ObjectNameUtil.TYPE_MODULE);
 
-        assertFailure(new Runnable() {
-            @Override
-            public void run() {
-                ObjectNameUtil.checkTypeOneOf(on, ObjectNameUtil.TYPE_RUNTIME_BEAN, ObjectNameUtil.TYPE_CONFIG_TRANSACTION);
-            }
-        }, IllegalArgumentException.class);
-
-        assertFailure(new Runnable() {
-            @Override
-            public void run() {
-                ObjectNameUtil.checkType(on, ObjectNameUtil.TYPE_RUNTIME_BEAN);
-            }
-        }, IllegalArgumentException.class);
-
-        assertFailure(new Runnable() {
-            @Override
-            public void run() {
-                ObjectNameUtil.checkDomain(on);
-            }
-        }, IllegalArgumentException.class);
+        assertFailure(
+                () -> ObjectNameUtil.checkTypeOneOf(on, ObjectNameUtil.TYPE_RUNTIME_BEAN, ObjectNameUtil.TYPE_CONFIG_TRANSACTION), IllegalArgumentException.class);
+
+        assertFailure(() -> ObjectNameUtil.checkType(on, ObjectNameUtil.TYPE_RUNTIME_BEAN), IllegalArgumentException.class);
+
+        assertFailure(() -> ObjectNameUtil.checkDomain(on), IllegalArgumentException.class);
     }
 
     private void assertFailure(final Runnable test, final Class<? extends Exception> ex) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.