Slight improvements to our UTs 25/25425/2
authorStephen Kitt <skitt@redhat.com>
Tue, 18 Aug 2015 14:06:30 +0000 (16:06 +0200)
committerStephen Kitt <skitt@redhat.com>
Tue, 18 Aug 2015 14:43:38 +0000 (16:43 +0200)
commit61da12bf0a6c648416e79ff42546471ef1ed3317
treeee2e983f1ff775fd4fcdbe5053a8a7854e9e829a
parent436426276e4fbb7c88476c5628b9b3637e5a207a
Slight improvements to our UTs

NetworkHandlerTest: explicitly split shared/non-shared testing instead
of relying on successive calls to isShared() (this avoids the test
being too closely linked to the implementation: the test only works if
the code calls isShared() in the way the test expects). Likewise for
isTunnel().

EventDispatcherImplTest:
* the event dispatcher is started by its constructor, no need to start
  it explicitly;
* specify a handler type in the mock event to avoid crashing the event
  handler;
* instead of "assuming" the event size (which was always wrong since
  the events were consumed before we got to the end of the test),
  check that the events were dispatched as appropriate.

ServiceHelper:
* in getGlobalInstance(), avoid an ArrayIndexOutOfBoundsException
* check for a null bundle explicitly; this avoids the tests causing a
  NullPointerException and producing error logs (and it also means we
  can log actual errors with more detail).

ServiceHelperTest: split the null/non-null tests so that we don't rely
on the implementation's calling pattern to getBundle().

Change-Id: Ib1b90fecf286588bc92a4c88f3b89d85c26c53f0
Signed-off-by: Stephen Kitt <skitt@redhat.com>
openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandlerTest.java
openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/EventDispatcherImplTest.java
utils/servicehelper/src/main/java/org/opendaylight/ovsdb/utils/servicehelper/ServiceHelper.java
utils/servicehelper/src/test/java/org/opendaylight/ovsdb/utils/servicehelper/ServiceHelperTest.java