use of org.jbpm.test.listener.IterableProcessEventListener.TrackedEvent in project jbpm by kiegroup.
the class IterableListenerAssert method assertChangedVariable.
/**
* Asserts that the variable was changed
*
* @param it listener that listened to the process
* @param name name of the variable
* @param oldValue expected old value or null
* @param newValue expected new value or null
*/
public static void assertChangedVariable(IterableProcessEventListener it, String name, Object oldValue, Object newValue) {
TrackedEvent event = getEvent(it);
Assertions.assertThat(event.getMethod()).isEqualTo(BEFORE_VARIABLE);
ProcessVariableChangedEvent orig = event.getEvent();
Assertions.assertThat(orig.getVariableId()).isEqualTo(name);
assertChangedVariableValues(orig, oldValue, newValue);
event = it.next();
Assertions.assertThat(event.getMethod()).isEqualTo(AFTER_VARIABLE);
orig = event.getEvent();
Assertions.assertThat(orig.getVariableId()).isEqualTo(name);
assertChangedVariableValues(orig, oldValue, newValue);
}
use of org.jbpm.test.listener.IterableProcessEventListener.TrackedEvent in project jbpm by kiegroup.
the class IterableListenerAssert method assertChangedMultipleInstancesVariable.
/**
* Asserts that the variable was changed within multipleInstances
* subprocess. Variable has prefix identifying this MI subprocess.
*
* @param it listener that listened to the process
* @param name name of the variable
* @param oldValue expected old value or null
* @param newValue expected new value or null
*/
public static void assertChangedMultipleInstancesVariable(IterableProcessEventListener it, String name, Object oldValue, Object newValue) {
TrackedEvent event = getEvent(it);
Assertions.assertThat(event.getMethod()).isEqualTo(BEFORE_VARIABLE);
ProcessVariableChangedEvent orig = event.getEvent();
Assertions.assertThat(orig.getVariableId().endsWith(":" + name)).isTrue();
assertChangedVariableValues(orig, oldValue, newValue);
event = it.next();
Assertions.assertThat(event.getMethod()).isEqualTo(AFTER_VARIABLE);
orig = event.getEvent();
Assertions.assertThat(orig.getVariableId().endsWith(":" + name)).isTrue();
assertChangedVariableValues(orig, oldValue, newValue);
}
Aggregations