[ovirt-devel] Line of death for tests

Shmuel Melamud smelamud at redhat.com
Thu Mar 16 09:55:07 UTC 2017


Hi!

I've found yesterday a very strange bug, most likely in Mockito. Hard
to believe it really happens, but I've reproduced it in different
environmentы and several revisions of oVirt master.

I've added the following line into MigrateVmCommand:

     private Integer actualDowntime;
+    private Object actualDowntimeLock;

This line causes ALL tests to fail with NullPointerException. Some
tests print such a stack trace:

java.lang.NullPointerException
    at org.mockito.internal.junit.util.TestName.getTestName(TestName.java:11)
    at org.mockito.internal.junit.MismatchReportingTestListener.testFinished(MismatchReportingTestListener.java:29)
    at org.mockito.internal.runners.DefaultInternalRunner$1$1.testFinished(DefaultInternalRunner.java:56)
    at org.junit.runner.notification.SynchronizedRunListener.testFinished(SynchronizedRunListener.java:56)
    at org.junit.runner.notification.RunNotifier$7.notifyListener(RunNotifier.java:190)
...

Name of the field doesn't matter, but type matters - changing the type
to Integer solved the problem.

Does anybody has an idea why this happens and how to fix it?

Shmuel


More information about the Devel mailing list