/** * Initializes the {@link ActionResponse} with default information. * * @param context the test context * @param metadata the current metadata object * @param actionType the current action */ private void initResult(TestContext context, Metadata metadata, SubEngineActionType actionType) { StringBuilder msg = new StringBuilder(); msg.append("Executing "); msg.append(getClass().getSimpleName().replace("Impl", "")); msg.append(" with name='"); msg.append(metadata != null ? metadata.getId() : "null"); msg.append(" and action='"); msg.append(actionType); msg.append("'"); this.result = TestResultHelper.createActionResponse(); this.result.setMessage(msg.toString()); }
/** * Fail the {@link ActionResponse} with an appropriate error message. * * @param metadata the current metadata object * @param actionType the current action * @param info optional messages added to the result. */ private void failResult(Metadata metadata, SubEngineActionType actionType, String... infos) { this.result.setActionStatus(ActionStatusType.FAILED); StringBuilder msg = new StringBuilder(); msg.append("Failed executing "); msg.append(getClass().getSimpleName().replace("Impl", "")); msg.append(" with name='"); msg.append(metadata != null ? metadata.getId() : "null"); msg.append("' and action='"); msg.append(actionType); msg.append("'. "); if (infos != null) { for (String info : infos) { msg.append(info); } } this.result.setErrorMessage(msg.toString()); }