Fix wrong event object comparison

- Classic case of using == vs. equals if Strings are involved.
- In DefaultStateMachineExecutor change event comparison
  from == to equals.
- Tests using enums naturally work, but some tests using Strings
  had a wrong checks.
- Fixes #253
This commit is contained in:
Janne Valkealahti
2016-09-26 10:29:01 +01:00
parent 29f67fdbf8
commit 8fc7592404
2 changed files with 11 additions and 11 deletions

View File

@@ -366,8 +366,8 @@ public class DefaultStateMachineExecutor<S, E> extends LifecycleObjectSupport im
Trigger<S, E> tri = e.getKey();
E ee = tri.getEvent();
Transition<S, E> tra = e.getValue();
if (event == ee) {
if (tra.getSource().getId() == id && !trans.contains(tra)) {
if (event.equals(ee)) {
if (tra.getSource().getId().equals(id) && !trans.contains(tra)) {
trans.add(tra);
continue;
}