當前位置: 首頁>>代碼示例>>Java>>正文


Java RestAssured.config方法代碼示例

本文整理匯總了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));
}
 
開發者ID:ERS-HCL,項目名稱:itest-starter,代碼行數:20,代碼來源:AbstractITest.java

示例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();
}
 
開發者ID:OpenLMIS,項目名稱:openlmis-stockmanagement,代碼行數:19,代碼來源:BaseWebIntegrationTest.java

示例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));
}
 
開發者ID:ERS-HCL,項目名稱:rest-yaml-test,代碼行數:12,代碼來源:AbstractITest.java


注:本文中的com.jayway.restassured.RestAssured.config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。