Update doc of class EventDispatcherImplTest. 58/17258/1
authorAlexis de Talhouët <adetalhouet@inocybe.com>
Fri, 27 Mar 2015 18:19:25 +0000 (14:19 -0400)
committerAlexis de Talhouët <adetalhouet@inocybe.com>
Fri, 27 Mar 2015 18:19:25 +0000 (14:19 -0400)
Change-Id: Ib781c519f2be1e99764de1358c0ab087f77cb36b
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/EventDispatcherImplTest.java

index 888d0c4cba8c91f3879de0c3543de426efbc359a..66ba75f8d9ca1b9e82668055b6037ab433487486 100644 (file)
@@ -48,7 +48,6 @@ public class EventDispatcherImplTest {
         eventDispatcherImpl.init();
         eventDispatcherImpl.start();
 
-        // configure serviceReference
         when(ref.getProperty(org.osgi.framework.Constants.SERVICE_ID)).thenReturn(r.nextLong());
         when(ref.getProperty(Constants.EVENT_HANDLER_TYPE_PROPERTY)).thenReturn(handlerTypeObject);
     }
@@ -58,17 +57,13 @@ public class EventDispatcherImplTest {
      */
     @Test
     public void testeventHandlerAdded() throws Exception{
-        // get handlers from EventDispatcherImpl for test purposes
         AbstractHandler[] handlers = ( AbstractHandler[]) getClassField("handlers");
 
-        // test when should be null
-        assertNotEquals(handlers[handlerTypeObject.ordinal()], handler);
+        assertNotEquals("Error, handler should be null", handlers[handlerTypeObject.ordinal()], handler);
 
-        // add handler
         eventDispatcherImpl.eventHandlerAdded(ref, handler);
 
-        // test when handler added
-        assertEquals(handlers[handlerTypeObject.ordinal()], handler);
+        assertEquals("Error, did not return the added handler", handlers[handlerTypeObject.ordinal()], handler);
     }
 
     /**
@@ -76,20 +71,15 @@ public class EventDispatcherImplTest {
      */
     @Test
     public void testHandlerRemoved() throws Exception{
-        // get handlers from EventDispatcherImpl for test purposes
         AbstractHandler[] handlers = ( AbstractHandler[]) getClassField("handlers");
 
-        // add a handler
         eventDispatcherImpl.eventHandlerAdded(ref, handler);
 
-        // test when handler added
-        assertEquals(handlers[handlerTypeObject.ordinal()], handler);
+        assertEquals("Error, did not return the added handler", handlers[handlerTypeObject.ordinal()], handler);
 
-        // remove handler
         eventDispatcherImpl.eventHandlerRemoved(ref);
 
-        // test once handler removed
-        assertNull(handlers[handlerTypeObject.ordinal()]);
+        assertNull("Error, handler should be null as it has just been removed", handlers[handlerTypeObject.ordinal()]);
     }
 
     /**
@@ -97,16 +87,12 @@ public class EventDispatcherImplTest {
      */
     @Test
     public void testEnqueueEvent() throws Exception{
-        // get events from EventDispatcherImpl for test purposes
         BlockingQueue<AbstractEvent> events = (BlockingQueue<AbstractEvent>) getClassField("events");
 
-        // test before enqueue event
         assertEquals("Error, did not return the expected size, nothing has been added yet", 0, events.size());
 
-        // enqueue event
         eventDispatcherImpl.enqueueEvent(mock(AbstractEvent.class));
 
-        // test after enqueue event
         assertEquals("Error, did not return the expected size", 1, events.size());
     }