BUG-5626: do not allow overriding of RaftActor.handleCommand()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / test / java / org / opendaylight / controller / cluster / raft / behaviors / AbstractLeaderElectionScenarioTest.java
index 31f2d62..36f5fd5 100644 (file)
@@ -62,10 +62,13 @@ public class AbstractLeaderElectionScenarioTest {
 
             try {
                 if(behavior != null && !dropMessagesToBehavior.containsKey(message.getClass())) {
-                    RaftActorBehavior oldBehavior = behavior;
-                    behavior = behavior.handleMessage(getSender(), message);
-                    if(behavior != oldBehavior && behaviorStateChangeLatch != null) {
-                        behaviorStateChangeLatch.countDown();
+                    final RaftActorBehavior nextBehavior = behavior.handleMessage(getSender(), message);
+                    if (nextBehavior != null) {
+                        RaftActorBehavior oldBehavior = behavior;
+                        behavior = nextBehavior;
+                        if(behavior != oldBehavior && behaviorStateChangeLatch != null) {
+                            behaviorStateChangeLatch.countDown();
+                        }
                     }
                 }
             } finally {