Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* The MIT License
*
* Copyright 2022 Karate Labs Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.intuit.karate;
import com.intuit.karate.core.AssignType;
import com.intuit.karate.core.Action;
import com.intuit.karate.core.ScenarioEngine;
import cucumber.api.DataTable;
import cucumber.api.java.en.When;
import java.util.List;
import java.util.Map;
/**
*
* @author pthomas3
*/
public class ScenarioActions implements Actions {
private final ScenarioEngine engine;
public ScenarioActions(ScenarioEngine engine) {
this.engine = engine;
}
@Override
public boolean isFailed() {
return engine.isFailed();
}
@Override
public Throwable getFailedReason() {
return engine.getFailedReason();
}
@Override
public boolean isAborted() {
return engine.isAborted();
}
@Override
@When("^configure ([^\\s]+) =$")
public void configureDocString(String key, String exp) {
engine.configure(key, exp);
}
@Override
@When("^configure\\h+([^\\s]+)\\h+= (.+)")
public void configure(String key, String exp) {
engine.configure(key, exp);
}
@Override
@When("^url (.+)")
public void url(String exp) {
engine.url(exp);
}
@Override
@When("^path (.+)")
public void path(String exp) {
engine.path(exp);
}
@Override
@When("^param\\h+([^\\s]+)\\h+= (.+)")
public void param(String name, String exp) {
engine.param(name, exp);
}
@Override
@When("^params (.+)")
public void params(String exp) {
engine.params(exp);
}
@Override
@When("^cookie\\h+([^\\s]+)\\h+= (.+)")
public void cookie(String name, String value) {
engine.cookie(name, value);
}
@Override
@When("^cookies (.+)")
public void cookies(String exp) {
engine.cookies(exp);
}
@Override
@When("^csv (.+) = (.+)")
public void csv(String name, String exp) {
engine.assign(AssignType.CSV, name, exp, false);
}
@Override
@When("^csv (.+) =$")
public void csvDocString(String name, String exp) {
engine.assign(AssignType.CSV, name, exp, true);
}
@Override
@When("^header\\h+([^\\s]+)\\h+= (.+)")
public void header(String name, String exp) {
engine.header(name, exp);
}
@Override
@When("^headers (.+)")
public void headers(String exp) {
engine.headers(exp);
}
@Override
@When("^form field\\h+([^\\s]+)\\h+= (.+)")
public void formField(String name, String exp) {
engine.formField(name, exp);
}
@Override
@When("^form fields (.+)")
public void formFields(String exp) {
engine.formFields(exp);
}
@Override
@When("^request$")
public void requestDocString(String body) {
engine.request(body);
}
@Override
@When("^request (.+)")
public void request(String body) {
engine.request(body);
}
@When("^table (.+)")
public void table(String name, DataTable table) {
table(name, table.asMaps(String.class, String.class));
}
@Override
@Action("^table (.+)")
public void table(String name, List