Move null check from getTotalMemory()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / test / java / org / opendaylight / controller / cluster / raft / AbstractRaftActorIntegrationTest.java
index b81dcc9..b30412f 100644 (file)
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
-import java.util.function.Supplier;
 import org.junit.After;
 import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyJournalEntries;
@@ -85,17 +84,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         }
 
         void setMockTotalMemory(final long mockTotalMemory) {
-            if(mockTotalMemory > 0) {
-                getRaftActorContext().setTotalMemoryRetriever(new Supplier<Long>() {
-                    @Override
-                    public Long get() {
-                        return mockTotalMemory;
-                    }
-
-                });
-            } else {
-                getRaftActorContext().setTotalMemoryRetriever(null);
-            }
+            getRaftActorContext().setTotalMemoryRetriever(mockTotalMemory > 0 ? () -> mockTotalMemory : null);
         }
 
         @Override

©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.