@Override
 public JSONObject checkTask(final Task rawTask, final JSONObject params) throws Exception {
   final StTask stTask = StTask.fromJson(rawTask.asJson());
   final StateMachineConfiguration config =
       StateMachineConfiguration.fromJson(params.getJSONObject("config"));
   final StTaskCheckResult result = checkConfig(stTask, config);
   return result.asJson();
 }
  private StTaskCheckResult checkConfig(final StTask stTask, final StateMachineConfiguration config)
      throws Exception {
    if (stTask.getType() == StTaskType.CREATE_ST_MACHINE) {
      final List<String> corrects = stTask.getCorrectStrings();
      final List<String> incorrects = stTask.getIncorrectStrings();
      for (final String correct : corrects) {
        if (!TaskerStateMachine.fire(config, correct)) {
          return new StTaskCheckResult("", correct, false);
        }
      }

      for (final String incorrect : incorrects) {
        if (TaskerStateMachine.fire(config, incorrect)) {
          return new StTaskCheckResult(incorrect, "", false);
        }
      }

      return StTaskCheckResult.OK;
    }
    throw new IllegalArgumentException(stTask.getType().name());
  }