Update unit tests
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / registry / meter / DeviceMeterRegistryImplTest.java
index dbc3e3aedc85c7e3e6cbc568bcd6747cf060a133..0aa1df8cfeccbca66fa61f1cdad6a5766076cf4f 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.openflowplugin.impl.registry.meter;
 
+import java.util.concurrent.atomic.AtomicInteger;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -52,7 +53,6 @@ public class DeviceMeterRegistryImplTest {
         Assert.assertEquals(1, deviceMeterRegistry.getAllMeterIds().size());
     }
 
-
     @Test
     public void testClose() throws Exception {
         deviceMeterRegistry.addMark(meterId);
@@ -65,4 +65,12 @@ public class DeviceMeterRegistryImplTest {
         Assert.assertEquals(1, deviceMeterRegistry.getAllMeterIds().size());
 
     }
+
+    @Test
+    public void testForEach() throws Exception {
+        final AtomicInteger counter = new AtomicInteger(0);
+        deviceMeterRegistry.store(meterId2);
+        deviceMeterRegistry.forEach(meter -> counter.incrementAndGet());
+        Assert.assertEquals(2, counter.get());
+    }
 }