Commit de4cf430 authored by John Lam's avatar John Lam

add application-test.properties and /api/products to tests

parent 40dcdddd
......@@ -18,7 +18,7 @@ public class ProductController {
@Autowired
ProductService productService;
@GetMapping("{sku}")
@GetMapping("/{sku}")
public ResponseEntity<Mono<ProductDto>> getProductBySku(@PathVariable String sku) {
Mono<ProductDto> monoProd = productService.getProductBySku(sku);
HttpStatus status = monoProd != null ? HttpStatus.OK : HttpStatus.NOT_FOUND;
......
spring.config.import=classpath:secret.properties
spring.data.mongodb.uri=mongodb+srv://admin:${db.password}@inventory-promotions.d4nfz.mongodb\
.net/${spring.data.mongodb.database}?retryWrites=true&w=majority
spring.data.mongodb.database=test
......@@ -42,7 +42,7 @@ class ProductControllerTest {
void testProductInvalidSkuNotFound() {
client
.get()
.uri("/products/".concat("{sku}"), "invalid")
.uri("/api/products/".concat("{sku}"), "invalid")
.exchange()
.expectStatus()
.isNotFound();
......@@ -50,10 +50,10 @@ class ProductControllerTest {
@Test
void testProductBySkuFound() {
String sku = "100000";
String sku = "000001";
client.get()
.uri("/products/".concat("/{sku}"), sku)
.uri("/api/products/".concat("/{sku}"), sku)
.exchange()
.expectStatus()
.isOk()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment