@Override
    public CurrentStateInformation trigger(MigrationStep step, Map<String, Object> args) {
        context.setCurrentStep(step);
        if (Objects.nonNull(args) && !args.isEmpty()) {
            context.addActionArguments(step, args);
        }
        String errorMessage = null;
        try {
            stateMachine.fire(step);
        } catch (Exception e) {
            errorMessage = Objects.nonNull(e.getMessage()) ? e.getMessage() : e.toString();
        }
        persistenceService.saveStateMachineContext(context);
        return new CurrentStateInformation(getState(), nextSteps(), errorMessage, context.getResponse());
    }
@Test
    public void smThrowsErrorOnWrongArgumentType() {
        StateMachine<MigrationState, MigrationStep> stateMachine = testStateMachineWithAction((context) -> {
            context.getActionArgument("k1", Integer.class);
        });
        migrationStateMachine = new MigrationStateMachineImpl(stateMachine, persistenceService, context);
        CurrentStateInformation context = migrationStateMachine.trigger(MIGRATION_STEP, Map.of("k1", "v1"));
        assertThat(context.hasErrors()).isTrue();
        assertThat(context.errorMessage()).isEqualTo("Argument k1 must be of type class java.lang.Integer");
    }