Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
inventory-service
Commits
de4cf430
Commit
de4cf430
authored
May 06, 2021
by
John Lam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add application-test.properties and /api/products to tests
parent
40dcdddd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
ProductController.java
.../nisum/ascend/inventory/controller/ProductController.java
+1
-1
application-test.properties
src/main/resources/application-test.properties
+5
-0
ProductControllerTest.java
...um/ascend/inventory/controller/ProductControllerTest.java
+3
-3
No files found.
src/main/java/com/nisum/ascend/inventory/controller/ProductController.java
View file @
de4cf430
...
@@ -18,7 +18,7 @@ public class ProductController {
...
@@ -18,7 +18,7 @@ public class ProductController {
@Autowired
@Autowired
ProductService
productService
;
ProductService
productService
;
@GetMapping
(
"{sku}"
)
@GetMapping
(
"
/
{sku}"
)
public
ResponseEntity
<
Mono
<
ProductDto
>>
getProductBySku
(
@PathVariable
String
sku
)
{
public
ResponseEntity
<
Mono
<
ProductDto
>>
getProductBySku
(
@PathVariable
String
sku
)
{
Mono
<
ProductDto
>
monoProd
=
productService
.
getProductBySku
(
sku
);
Mono
<
ProductDto
>
monoProd
=
productService
.
getProductBySku
(
sku
);
HttpStatus
status
=
monoProd
!=
null
?
HttpStatus
.
OK
:
HttpStatus
.
NOT_FOUND
;
HttpStatus
status
=
monoProd
!=
null
?
HttpStatus
.
OK
:
HttpStatus
.
NOT_FOUND
;
...
...
src/main/resources/application-test.properties
0 → 100644
View file @
de4cf430
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
src/test/java/com/nisum/ascend/inventory/controller/ProductControllerTest.java
View file @
de4cf430
...
@@ -42,7 +42,7 @@ class ProductControllerTest {
...
@@ -42,7 +42,7 @@ class ProductControllerTest {
void
testProductInvalidSkuNotFound
()
{
void
testProductInvalidSkuNotFound
()
{
client
client
.
get
()
.
get
()
.
uri
(
"/products/"
.
concat
(
"{sku}"
),
"invalid"
)
.
uri
(
"/
api/
products/"
.
concat
(
"{sku}"
),
"invalid"
)
.
exchange
()
.
exchange
()
.
expectStatus
()
.
expectStatus
()
.
isNotFound
();
.
isNotFound
();
...
@@ -50,10 +50,10 @@ class ProductControllerTest {
...
@@ -50,10 +50,10 @@ class ProductControllerTest {
@Test
@Test
void
testProductBySkuFound
()
{
void
testProductBySkuFound
()
{
String
sku
=
"
100000
"
;
String
sku
=
"
000001
"
;
client
.
get
()
client
.
get
()
.
uri
(
"/products/"
.
concat
(
"/{sku}"
),
sku
)
.
uri
(
"/
api/
products/"
.
concat
(
"/{sku}"
),
sku
)
.
exchange
()
.
exchange
()
.
expectStatus
()
.
expectStatus
()
.
isOk
()
.
isOk
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment