class PostmanService {

    String toStep(NewmanScenario newmanScenario, int line) {
        if (line == LINE_PRE_REQUEST_SCRIPT) {
            return STEP_PRE_REQUEST_SCRIPT;
        }
        if (line == LINE_TEST_SCRIPT) {
            return STEP_TEST_SCRIPT;
        }
        Assertion[] assertions = newmanScenario.getExecution().getAssertions();
        if (assertions != null && line >= 0 && assertions.length > line) {
            return assertions[line].getName();
        }
        // Here, there is no assertion OR the line is not part of the assertions:
        // the only thing that can fail is the request itself.
        // When the request is empty, line is -1 and assertions is null: we catch other strange cases (more negative line, etc.) as a request failure
        return buildRequestStep(newmanScenario.getItem().getRequest());
    }

}