本文整理汇总了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));
}