use of io.spine.server.entity.Transaction in project core-java by SpineEventEngine.
the class TestTransaction method injectState.
/**
* A hack allowing to inject state and version into an {@code EventPlayingEntity} instance
* by creating and committing a fake transaction.
*
* <p>To be used in tests only.
*/
public static void injectState(EventPlayingEntity entity, Message state, Version version) {
@SuppressWarnings("unchecked") final Transaction tx = new Transaction(entity, state, version) {
@Override
protected void dispatch(EventPlayingEntity entity, Message eventMessage, EventContext context) throws InvocationTargetException {
// do nothing.
}
};
tx.commit();
}
Aggregations