Bug 4881 - failure in netvirt.AbstractEventTest
authorIsaku Yamahata <isaku.yamahata@intel.com>
Wed, 6 Jan 2016 01:12:10 +0000 (17:12 -0800)
committerIsaku Yamahata <isaku.yamahata@intel.com>
Wed, 6 Jan 2016 01:12:10 +0000 (17:12 -0800)
build fails with the following failure.
transaction id of the event can't be assumed to be 1 because other
tests may have created (subclass of) abstract event before running
this test. This patch to get transaction id from the event and use it
instead of hard-coded 1.

> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.029 sec <<< FAILURE! - in org.opendaylight.ovsdb.openstack.netvirt.AbstractEventTest
> testAbstractEvent(org.opendaylight.ovsdb.openstack.netvirt.AbstractEventTest)  Time elapsed: 0.017 sec  <<< FAILURE!
> org.junit.ComparisonFailure: Error, toString() did not return the correct value expected:<...vent [transactionId=[1] handlerType=SOUTHBO...> but was:<...vent [transactionId=[5] handlerType=SOUTHBO...>
>         at org.junit.Assert.assertEquals(Assert.java:115)
>         at org.opendaylight.ovsdb.openstack.netvirt.AbstractEventTest.testAbstractEvent(AbstractEventTest.java:59)

Change-Id: I1f351b92a684e8ece17246d8f0011cbffe95409f
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/AbstractEventTest.java

index 70196830f93ac51db7f91a64b73da028734f68b1..6e776d3a2b23a0105742d848f517197b8cd59721 100644 (file)
@@ -56,7 +56,8 @@ public class AbstractEventTest {
         assertNotNull("Error, hashCode() did not return any value", abstractEvent1.hashCode());
         assertEquals("Error, hashCode() is not consistent", abstractEvent2.hashCode(), abstractEvent3.hashCode());
 
+        int transactionId = abstractEvent1.getTransactionId();
         assertEquals("Error, toString() did not return the correct value",
-                "AbstractEvent [transactionId=1 handlerType=SOUTHBOUND action=DELETE]", abstractEvent1.toString());
+                "AbstractEvent [transactionId=" + transactionId + " handlerType=SOUTHBOUND action=DELETE]", abstractEvent1.toString());
     }
 }