本文整理汇总了Java中com.jayway.restassured.builder.ResponseSpecBuilder.expectStatusCode方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseSpecBuilder.expectStatusCode方法的具体用法?Java ResponseSpecBuilder.expectStatusCode怎么用?Java ResponseSpecBuilder.expectStatusCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jayway.restassured.builder.ResponseSpecBuilder
的用法示例。
在下文中一共展示了ResponseSpecBuilder.expectStatusCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable springBoot =
MavenDeployables.downloadLatest(
"org.springframework.boot", "spring-boot-deployment-test-tomcat", DeployableType.WAR);
JettyContainer container1 =
JettyContainerBuilder.forDeployable(springBoot).build();
JettyContainer container2 =
JettyContainerBuilder.forDeployable(springBoot).build();
config(Config.defaultConnection());
bindContainer("spring1", container1);
bindContainer("spring2", container2);
}
示例2: getLocationOkResponseSpecification
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
private ResponseSpecification getLocationOkResponseSpecification(String id, String name, String type, String createdUsername, String modifiedUsername) {
String resourcePath = getLocationResourcePath(baseURL);
ResponseSpecBuilder builder = new ResponseSpecBuilder();
builder.expectStatusCode(200);
builder.expectBody("id", equalTo(id));
builder.expectBody("name", equalTo(name));
builder.expectBody("description", nullValue());
builder.expectBody("type", equalTo(type));
builder.expectBody("created", notNullValue(String.class));
builder.expectBody("created_by", equalTo(createdUsername));
builder.expectBody("last_modified", notNullValue(String.class));
builder.expectBody("last_modified_by", equalTo(modifiedUsername));
builder.expectBody("links.self.href", equalTo(resourcePath + "/" + id));
builder.expectBody("links.configuration.href", equalTo(resourcePath + "/" + id + "/configuration"));
builder.expectBody("links.template.href", equalTo(resourcePath + "/templates/" + type));
return builder.build();
}
示例3: getWorkerOkResponseSpecification
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
private ResponseSpecification getWorkerOkResponseSpecification(String workerId, String name, String status, String createdUsername, String modifiedUsername, String... externalIds) {
String workerResourcePath = getWorkersResourcePath(baseURL);
ResponseSpecBuilder builder = new ResponseSpecBuilder();
builder.expectStatusCode(200);
builder.expectBody("name", equalTo(name));
builder.expectBody("external_ids", contains(externalIds));
builder.expectBody("status.current", equalTo(status));
builder.expectBody("status.timestamp", notNullValue(String.class));
builder.expectBody("created", notNullValue(String.class));
builder.expectBody("created_by", equalTo(createdUsername));
builder.expectBody("last_modified", notNullValue(String.class));
builder.expectBody("last_modified_by", equalTo(modifiedUsername));
builder.expectBody("links.self.href", equalTo(workerResourcePath + "/" + workerId));
builder.expectBody("links.messages.href", equalTo(workerResourcePath + "/" + workerId + "/messages"));
builder.expectBody("links.status.href", equalTo(workerResourcePath + "/" + workerId + "/status"));
builder.expectBody("links.tasks.href", equalTo(workerResourcePath + "/" + workerId + "/tasks"));
return builder.build();
}
示例4: getJobOkResponseSpecification
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
private ResponseSpecification getJobOkResponseSpecification(String jobId, String name, String type, String status, int priority, String createdUsername, String modifiedUsername,
String... externalIds) {
String jobResource = getJobResourcePath(baseURL);
ResponseSpecBuilder builder = new ResponseSpecBuilder();
builder.expectStatusCode(200);
builder.expectBody("name", equalTo(name));
builder.expectBody("external_ids", contains(externalIds));
builder.expectBody("type", equalTo(type));
builder.expectBody("status.current", equalTo(status));
builder.expectBody("status.timestamp", notNullValue(String.class));
builder.expectBody("priority", equalTo(priority));
builder.expectBody("created", notNullValue(String.class));
builder.expectBody("created_by", equalTo(createdUsername));
builder.expectBody("last_modified", notNullValue(String.class));
builder.expectBody("last_modified_by", equalTo(modifiedUsername));
builder.expectBody("links.self.href", equalTo(jobResource + "/" + jobId));
builder.expectBody("links.configuration.href", equalTo(jobResource + "/" + jobId + "/configuration"));
builder.expectBody("links.status.href", equalTo(jobResource + "/" + jobId + "/status"));
return builder.build();
}
示例5: shouldReturnOkOnGetAssetsWithResultsUsingOnlyCount
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Test
public void shouldReturnOkOnGetAssetsWithResultsUsingOnlyCount() throws Exception {
String assetResourcePath = RestIntegrationTests.getAssetsResourcePath(baseURL);
for (int i = 0; i < 30; i++) {
String json = "{ \"name\" : \"test1\", \"external_ids\" : [\"id1\", \"id2\"]}";
RestIntegrationTests.post(assetResourcePath, json, "editor", "password", Optional.of("v1"), Optional.empty());
}
ResponseSpecBuilder responseSpecBuilder = new ResponseSpecBuilder();
responseSpecBuilder.expectStatusCode(200);
responseSpecBuilder.expectBody("page", nullValue());
responseSpecBuilder.expectBody("per_page", nullValue());
responseSpecBuilder.expectBody("total_pages", nullValue());
responseSpecBuilder.expectBody("total_count", equalTo(30));
responseSpecBuilder.expectBody("data", hasSize(0));
responseSpecBuilder.expectBody("links", nullValue());
com.jayway.restassured.response.Response response = RestIntegrationTests.get(assetResourcePath + "?only_count=true", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
// Validate Link Headers
assertThat(response.header("Link")).isNull();
}
示例6: getRepositoryOkResponseSpecification
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
private ResponseSpecification getRepositoryOkResponseSpecification(String id, String name, String type, String createdUsername, String modifiedUsername) {
ResponseSpecBuilder builder = new ResponseSpecBuilder();
builder.expectStatusCode(200);
builder.expectBody("id", equalTo(id));
builder.expectBody("name", equalTo(name));
builder.expectBody("description", nullValue());
builder.expectBody("type", equalTo(type));
builder.expectBody("created", notNullValue(String.class));
builder.expectBody("created_by", equalTo(createdUsername));
builder.expectBody("last_modified", notNullValue(String.class));
builder.expectBody("last_modified_by", equalTo(modifiedUsername));
builder.expectBody("links.self.href", equalTo(getRepositoriesResourcePath() + "/" + id));
builder.expectBody("links.configuration.href", equalTo(getRepositoriesResourcePath() + "/" + id + "/configuration"));
builder.expectBody("links.template.href", equalTo(getRepositoriesResourcePath() + "/templates/" + type));
return builder.build();
}
示例7: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable springBoot =
MavenDeployables.downloadLatest(
"org.springframework.boot", "spring-boot-deployment-test-tomcat", DeployableType.WAR);
TomcatContainer container =
TomcatContainerBuilder.forDeployable(springBoot).deployContext("springboot").build();
config(Config.defaultConnection());
bindContainer("spring", container);
}
示例8: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable springBoot =
MavenDeployables.downloadLatest(
"org.springframework.boot", "spring-boot-deployment-test-tomcat", DeployableType.WAR);
TomcatContainer container =
TomcatContainerBuilder.forDeployable(springBoot).build();
config(Config.defaultConnection());
bindContainer("spring", container);
}
示例9: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable springBoot =
MavenDeployables.downloadLatest(
"org.springframework.boot", "spring-boot-deployment-test-tomcat", DeployableType.WAR);
JettyContainer container =
JettyContainerBuilder.forDeployable(springBoot).deployContext("springboot").build();
config(Config.defaultConnection());
bindContainer("spring", container);
}
示例10: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable springBoot =
MavenDeployables.downloadLatest(
"org.springframework.boot", "spring-boot-deployment-test-tomcat", DeployableType.WAR);
JettyContainer container =
JettyContainerBuilder.forDeployable(springBoot).deployContext("/").build();
config(Config.defaultConnection());
bindContainer("spring", container);
}
示例11: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable springBoot =
MavenDeployables.downloadLatest(
"org.springframework.boot", "spring-boot-deployment-test-tomcat", DeployableType.WAR);
JettyContainer container =
JettyContainerBuilder.forDeployable(springBoot).build();
config(Config.defaultConnection());
bindContainer("spring", container);
}
示例12: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable localApp = WarDeployables.named("localapp").addPackage(HelloServlet.class.getPackage())
.withPomDependencies().build();
JettyContainer container = JettyContainerBuilder.forDeployable(localApp).deployContext("/").build();
config(Config.defaultConnection());
bindContainer("local", container);
}
示例13: configureContainers
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Override
protected void configureContainers() {
ResponseSpecBuilder specBuilder = new ResponseSpecBuilder();
specBuilder.expectStatusCode(200);
Deployable localApp = WarDeployables.named("localapp")
.addPackage(HelloServlet.class.getPackage())
.withPomDependencies()
.build();
JettyContainer container =
JettyContainerBuilder.forDeployable(localApp).deployContext("/").build();
bindContainer("local", container);
}
示例14: shouldReturnOkOnGetWorkersFilteredByNameWithSpaces
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Test
public void shouldReturnOkOnGetWorkersFilteredByNameWithSpaces() throws Exception {
String workerResourcePath = getWorkersResourcePath(baseURL);
for (int i = 0; i < 5; i++) {
String json = "{ \"name\" : \"test " + i + "\", \"external_ids\" : [\"id1\", \"id2\"]}";
post(workerResourcePath, json, "editor", "password", Optional.of("v1"), Optional.empty());
}
ResponseSpecBuilder responseSpecBuilder = new ResponseSpecBuilder();
responseSpecBuilder.expectStatusCode(200);
responseSpecBuilder.expectBody("data.name", contains("test 0"));
// the RestAssured framework auto escapes the space to %20
get(workerResourcePath + "?name[eq]=test 0", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
}
示例15: shouldReturnOkOnGetLocationTemplate
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入方法依赖的package包/类
@Test
public void shouldReturnOkOnGetLocationTemplate() throws Exception {
ResponseSpecBuilder builder = new ResponseSpecBuilder();
builder.expectStatusCode(200);
builder.expectBody("type", equalTo("FILE"));
builder.expectBody("properties.name", contains("root"));
get(getLocationTemplateResourceUrlAsString() + "/FILE", "reader", "password", Optional.of("v1"), Optional.of(builder.build()));
}