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
d205dffe
Commit
d205dffe
authored
May 05, 2021
by
Khai Yuan Liew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AFP-55] Modifiy GET controller test
parent
dd26d3cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
ProductControllerTest.java
...um/ascend/inventory/controller/ProductControllerTest.java
+9
-2
No files found.
src/test/java/com/nisum/ascend/inventory/controller/ProductControllerTest.java
View file @
d205dffe
...
@@ -13,10 +13,16 @@ import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWeb
...
@@ -13,10 +13,16 @@ import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWeb
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.mock.mockito.MockBean
;
import
org.springframework.boot.test.mock.mockito.MockBean
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit.jupiter.SpringExtension
;
import
org.springframework.test.context.junit.jupiter.SpringExtension
;
import
org.springframework.test.web.reactive.server.WebTestClient
;
import
org.springframework.test.web.reactive.server.WebTestClient
;
import
org.springframework.web.reactive.function.client.WebClient
;
import
java.util.List
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
@ExtendWith
(
SpringExtension
.
class
)
@ExtendWith
(
SpringExtension
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
...
@@ -37,10 +43,11 @@ class ProductControllerTest {
...
@@ -37,10 +43,11 @@ class ProductControllerTest {
void
testFindAllProducts
(){
void
testFindAllProducts
(){
webTestClient
.
get
()
webTestClient
.
get
()
.
uri
(
"/api/products"
)
.
uri
(
"/api/products"
)
.
header
(
HttpHeaders
.
ACCEPT
,
"application/json"
)
.
exchange
()
.
exchange
()
.
expectStatus
().
isOk
()
.
expectStatus
().
isOk
()
.
expectBodyList
(
Product
.
class
);
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
returnResult
(
Product
.
class
)
.
getResponseBody
();
}
}
...
...
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