本文整理汇总了Java中com.jayway.restassured.builder.ResponseSpecBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ResponseSpecBuilder类的具体用法?Java ResponseSpecBuilder怎么用?Java ResponseSpecBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResponseSpecBuilder类属于com.jayway.restassured.builder包,在下文中一共展示了ResponseSpecBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldNotChangeAnythingAfterCancel
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldNotChangeAnythingAfterCancel() throws Exception {
page.endpoint(NEW_ENDPOINT)
.apiType(NEW_API_TYPE)
.cancel();
page.endpoint()
.shouldHave(value(apiVersion.getEndpoint()));
page.apiType()
.shouldHave(text(apiVersion.getEndpointType().toString()));
assertApiVersion(apiVersion, new ResponseSpecBuilder()
.expectBody("endpoint", equalTo(apiVersion.getEndpoint()))
.expectBody("endpointType", equalTo(apiVersion.getEndpointType().toString()))
.build());
}
示例2: 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);
}
示例3: shouldReturnOkOnGetJobsUsingOnlyCount
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetJobsUsingOnlyCount() throws Exception {
String jobResource = getJobResourcePath(baseURL);
for (int i = 0; i < 30; i++) {
post(jobResource, getCreateJobJsonRequired(variantId, repositoryId), "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 = get(getJobResourcePath(baseURL) + "?only_count=true", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
// Validate Link Headers
assertThat(response.header("Link")).isNull();
}
示例4: shouldReturnOkOnGetJobsDefaultSort
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetJobsDefaultSort() throws Exception {
String jobResource = getJobResourcePath(baseURL);
for (int i = 0; i < 5; i++) {
String json = "{ \"name\" : \"test" + i + "\", \"external_ids\" : [\"id\"], \"status\" : \"UNSUBMITTED\", \"type\" : \"INGEST\", \"priority\": 4, \"configuration\" : " +
getJobConfigurationJson(variantId, repositoryId) + "}";
post(jobResource, json, "editor", "password", Optional.of("v1"), Optional.empty());
}
ResponseSpecBuilder responseSpecBuilder = new ResponseSpecBuilder();
responseSpecBuilder.expectStatusCode(200);
responseSpecBuilder.expectBody("data.name", contains("test4", "test3", "test2", "test1", "test0"));
get(getJobResourcePath(baseURL), "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
}
示例5: shouldReturnOkOnGetJobsSortNameAsc
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetJobsSortNameAsc() throws Exception {
String jobResource = getJobResourcePath(baseURL);
for (int i = 0; i < 5; i++) {
String json = "{ \"name\" : \"test" + i + "\", \"external_ids\" : [\"id\"], \"status\" : \"UNSUBMITTED\", \"type\" : \"INGEST\", \"priority\": 4, \"configuration\" : " +
getJobConfigurationJson(variantId, repositoryId) + "}";
post(jobResource, json, "editor", "password", Optional.of("v1"), Optional.empty());
}
ResponseSpecBuilder responseSpecBuilder = new ResponseSpecBuilder();
responseSpecBuilder.expectStatusCode(200);
responseSpecBuilder.expectBody("data.name", contains("test0", "test1", "test2", "test3", "test4"));
get(getJobResourcePath(baseURL) + "?sort=name&order=ASC", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
}
示例6: shouldReturnOkOnGetJobsFilteredByNameEqual
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetJobsFilteredByNameEqual() throws Exception {
String jobResource = getJobResourcePath(baseURL);
for (int i = 0; i < 5; i++) {
String json = "{ \"name\" : \"test" + i + "\", \"external_ids\" : [\"id\"], \"status\" : \"UNSUBMITTED\", \"type\" : \"INGEST\", \"priority\": 4, \"configuration\" : " +
getJobConfigurationJson(variantId, repositoryId) + "}";
post(jobResource, json, "editor", "password", Optional.of("v1"), Optional.empty());
}
ResponseSpecBuilder responseSpecBuilder = new ResponseSpecBuilder();
responseSpecBuilder.expectStatusCode(200);
responseSpecBuilder.expectBody("data.name", contains("test0"));
get(getJobResourcePath(baseURL) + "?name[eq]=test0", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
}
示例7: shouldReturnOkOnGetJobsFilteredByNameWithSpaces
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetJobsFilteredByNameWithSpaces() throws Exception {
String jobResource = getJobResourcePath(baseURL);
for (int i = 0; i < 5; i++) {
String json = "{ \"name\" : \"test " + i + "\", \"external_ids\" : [\"id\"], \"status\" : \"UNSUBMITTED\", \"type\" : \"INGEST\", \"priority\": 4, \"configuration\" : " +
getJobConfigurationJson(variantId, repositoryId) + "}";
post(jobResource, 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(getJobResourcePath(baseURL) + "?name[eq]=test 0", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
}
示例8: shouldReturnOkOnGetJobsFilteredByNameLike
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetJobsFilteredByNameLike() throws Exception {
String jobResource = getJobResourcePath(baseURL);
for (int i = 0; i < 5; i++) {
String json = "{ \"name\" : \"test" + i + "\", \"external_ids\" : [\"id\"], \"status\" : \"UNSUBMITTED\", \"type\" : \"INGEST\", \"priority\": 4, \"configuration\" : " +
getJobConfigurationJson(variantId, repositoryId) + "}";
post(jobResource, json, "editor", "password", Optional.of("v1"), Optional.empty());
}
ResponseSpecBuilder responseSpecBuilder = new ResponseSpecBuilder();
responseSpecBuilder.expectStatusCode(200);
responseSpecBuilder.expectBody("data.name", contains("test3"));
get(getJobResourcePath(baseURL) + "?name[like]=3", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
}
示例9: 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();
}
示例10: shouldReturnOkOnGetRepositoriesWithResultsUsingOnlyCount
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetRepositoriesWithResultsUsingOnlyCount() throws Exception {
String resourcePath = getRepositoriesResourcePath();
for (int i = 0; i < 30; i++) {
String json = "{ \"name\" : \"test" + i + "\", \"type\" : \"FILE\"}";
post(resourcePath, 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 = get(resourcePath + "?only_count=true", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
// Validate Link Headers
assertThat(response.header("Link")).isNull();
}
示例11: 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();
}
示例12: 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();
}
示例13: getAssetOkResponseSpecification
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
private ResponseSpecification getAssetOkResponseSpecification(String assetId, String name, String createdUsername, String modifiedUsername, String... externalIds) {
String assetResourcePath = RestIntegrationTests.getAssetsResourcePath(baseURL);
ResponseSpecBuilder builder = new ResponseSpecBuilder();
builder.expectStatusCode(200);
builder.expectBody("name", equalTo(name));
builder.expectBody("external_ids", contains(externalIds));
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(assetResourcePath + "/" + assetId));
builder.expectBody("links.related.href", equalTo(assetResourcePath + "/" + assetId + "/related"));
builder.expectBody("links.parent.href", equalTo(assetResourcePath + "/" + assetId + "/parent"));
builder.expectBody("links.children.href", equalTo(assetResourcePath + "/" + assetId + "/children"));
builder.expectBody("links.variants.href", equalTo(assetResourcePath + "/" + assetId + "/variants"));
builder.expectBody("links.metadata.href", equalTo(assetResourcePath + "/" + assetId + "/metadata"));
return builder.build();
}
示例14: shouldReturnOkOnGetVariantsWithResultsUsingOnlyCount
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetVariantsWithResultsUsingOnlyCount() throws Exception {
for (int i = 0; i < 30; i++) {
String json = "{ \"name\" : \"test1\", \"external_ids\" : [\"id1\", \"id2\"]}";
post(getVariantsResourcePath(baseURL, assetId), 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());
UriBuilder uriBuilder = UriBuilder.fromUri(Throwables.returnableInstance(baseURL::toURI));
uriBuilder.path("api/assets/{assetId}/variants");
uriBuilder.queryParam("only_count", true);
com.jayway.restassured.response.Response response = get(uriBuilder.build(assetId).toString(), "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
// Validate Link Headers
assertThat(response.header("Link")).isNull();
}
示例15: shouldReturnOkOnGetWorkersWithResultsUsingOnlyCount
import com.jayway.restassured.builder.ResponseSpecBuilder; //导入依赖的package包/类
@Test
public void shouldReturnOkOnGetWorkersWithResultsUsingOnlyCount() throws Exception {
String workerResourcePath = getWorkersResourcePath(baseURL);
for (int i = 0; i < 30; i++) {
String json = "{ \"name\" : \"test1\", \"external_ids\" : [\"id1\", \"id2\"]}";
post(workerResourcePath, 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 = get(workerResourcePath + "?only_count=true", "reader", "password", Optional.of("v1"), Optional.of(responseSpecBuilder.build()));
// Validate Link Headers
assertThat(response.header("Link")).isNull();
}