Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
promotions-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
promotions-service
Commits
69a4a442
Commit
69a4a442
authored
May 06, 2021
by
Ben Anderson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created test for getPromotionByPromoId
parent
ae8d9aba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
PromotionsControllerTest.java
...scend/promotions/controller/PromotionsControllerTest.java
+15
-1
No files found.
src/test/java/com/nisum/ascend/promotions/controller/PromotionsControllerTest.java
View file @
69a4a442
package
com
.
nisum
.
ascend
.
promotions
.
controller
;
package
com
.
nisum
.
ascend
.
promotions
.
controller
;
import
com.nisum.ascend.promotions.dto.PromotionDto
;
import
com.nisum.ascend.promotions.dto.PromotionDto
;
import
com.nisum.ascend.promotions.model.Promotion
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
...
@@ -28,9 +27,15 @@ import static org.junit.jupiter.api.Assertions.*;
...
@@ -28,9 +27,15 @@ import static org.junit.jupiter.api.Assertions.*;
class
PromotionsControllerTest
{
class
PromotionsControllerTest
{
@Autowired
@Autowired
private
WebTestClient
webTestClient
;
private
WebTestClient
webTestClient
;
@BeforeEach
@BeforeEach
void
setUp
()
{
void
setUp
()
{
}
}
WebTestClient
.
ResponseSpec
getPromotionWebClient
(
String
promoId
)
{
return
webTestClient
.
get
().
uri
(
"/api/promos/"
+
promoId
).
exchange
();
}
@Test
@Test
void
getAllPromotions
()
{
void
getAllPromotions
()
{
webTestClient
.
get
().
uri
(
"http://localhost:8081/api/promos"
).
exchange
()
webTestClient
.
get
().
uri
(
"http://localhost:8081/api/promos"
).
exchange
()
...
@@ -48,4 +53,13 @@ class PromotionsControllerTest {
...
@@ -48,4 +53,13 @@ class PromotionsControllerTest {
});
});
});
});
}
}
@Test
void
getPromotionById
()
{
getPromotionWebClient
(
"0003"
)
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
expectBody
()
.
jsonPath
(
"promotionId"
,
"0003"
);
}
}
}
\ No newline at end of file
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