Java Code Examples for org.springframework.test.web.reactive.server.WebTestClient#BodyContentSpec

The following examples show how to use org.springframework.test.web.reactive.server.WebTestClient#BodyContentSpec . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProductServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(String productIdPath, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product" + productIdPath)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 2
Source File: RecommendationServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyRecommendationsByProductId(String productIdQuery, HttpStatus expectedStatus) {
	return client.get()
		.uri("/recommendation" + productIdQuery)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 3
Source File: ProductServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(String productIdPath, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product" + productIdPath)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 4
Source File: ProductServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(String productIdPath, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product" + productIdPath)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 5
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyReviewsByProductId(String productIdQuery, HttpStatus expectedStatus) {
	return client.get()
		.uri("/review" + productIdQuery)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 6
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyReviewsByProductId(String productIdQuery, HttpStatus expectedStatus) {
	return client.get()
		.uri("/review" + productIdQuery)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 7
Source File: RecommendationServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyRecommendationsByProductId(String productIdQuery, HttpStatus expectedStatus) {
	return client.get()
		.uri("/recommendation" + productIdQuery)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 8
Source File: ProductCompositeServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(int productId, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product-composite/" + productId)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 9
Source File: ProductCompositeServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(int productId, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product-composite/" + productId)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 10
Source File: ProductCompositeServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(int productId, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product-composite/" + productId)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 11
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyReviewsByProductId(String productIdQuery, HttpStatus expectedStatus) {
	return client.get()
		.uri("/review" + productIdQuery)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 12
Source File: RecommendationServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyRecommendationsByProductId(String productIdQuery, HttpStatus expectedStatus) {
	return client.get()
		.uri("/recommendation" + productIdQuery)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 13
Source File: ProductCompositeServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(int productId, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product-composite/" + productId)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 14
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec deleteAndVerifyReviewsByProductId(int productId, HttpStatus expectedStatus) {
	return client.delete()
		.uri("/review?productId=" + productId)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectBody();
}
 
Example 15
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec postAndVerifyReview(int productId, int reviewId, HttpStatus expectedStatus) {
	Review review = new Review(productId, reviewId, "Author " + reviewId, "Subject " + reviewId, "Content " + reviewId, "SA");
	return client.post()
		.uri("/review")
		.body(just(review), Review.class)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 16
Source File: ProductServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 5 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(String productIdPath, HttpStatus expectedStatus) {
	return client.get()
		.uri("/product" + productIdPath)
		.accept(APPLICATION_JSON_UTF8)
		.exchange()
		.expectStatus().isEqualTo(expectedStatus)
		.expectHeader().contentType(APPLICATION_JSON_UTF8)
		.expectBody();
}
 
Example 17
Source File: ProductServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 4 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyProduct(int productId, HttpStatus expectedStatus) {
	return getAndVerifyProduct("/" + productId, expectedStatus);
}
 
Example 18
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 4 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyReviewsByProductId(int productId, HttpStatus expectedStatus) {
	return getAndVerifyReviewsByProductId("?productId=" + productId, expectedStatus);
}
 
Example 19
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 4 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyReviewsByProductId(int productId, HttpStatus expectedStatus) {
	return getAndVerifyReviewsByProductId("?productId=" + productId, expectedStatus);
}
 
Example 20
Source File: ReviewServiceApplicationTests.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 4 votes vote down vote up
private WebTestClient.BodyContentSpec getAndVerifyReviewsByProductId(int productId, HttpStatus expectedStatus) {
	return getAndVerifyReviewsByProductId("?productId=" + productId, expectedStatus);
}