本文整理匯總了Java中com.jayway.restassured.RestAssured.config方法的典型用法代碼示例。如果您正苦於以下問題:Java RestAssured.config方法的具體用法?Java RestAssured.config怎麽用?Java RestAssured.config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jayway.restassured.RestAssured
的用法示例。
在下文中一共展示了RestAssured.config方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
* Initial Setup
*/
@Before
public void setUp() {
this.activeProfile = RestUtil.getCurrentProfile();
this.conf = ConfigFactory.load("application-" + this.activeProfile);
this.baseURI = conf.getString("server.baseURI");
this.port = conf.getInt("server.port");
this.timeout = conf.getInt("service.api.timeout");
final RequestSpecBuilder build = new RequestSpecBuilder().setBaseUri(baseURI).setPort(port);
rspec = build.build();
RestAssured.config = new RestAssuredConfig().encoderConfig(encoderConfig().defaultContentCharset("UTF-8")
.encodeContentTypeAs("application-json", ContentType.JSON));
}
示例2: init
import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
/**
* Method called to initialize basic resources after the object is created.
*/
@PostConstruct
public void init() {
mockExternalAuthorization();
RestAssured.baseURI = BASE_URL;
RestAssured.port = serverPort;
RestAssured.config = RestAssuredConfig.config().objectMapperConfig(
new ObjectMapperConfig().jackson2ObjectMapperFactory((clazz, charset) -> objectMapper)
);
RamlDefinition ramlDefinition = RamlLoaders.fromClasspath()
.load("api-definition-raml.yaml").ignoringXheaders();
restAssured = ramlDefinition.createRestAssured();
}
示例3: abstractSetUp
import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
public static void abstractSetUp() throws Exception {
baseURL = Environment.instance().getBaseURL();
port = Environment.instance().getPort();
certificates = Environment.instance().getCertificates();
final RequestSpecBuilder build = new RequestSpecBuilder().setBaseUri(baseURL).setPort(port);
rspec = build.build();
RestAssured.config().sslConfig(SSLConfig.sslConfig().relaxedHTTPSValidation());
RestAssured.config = new RestAssuredConfig().encoderConfig(encoderConfig().defaultContentCharset("UTF-8"))
.redirect(redirectConfig().followRedirects(false));
}