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
99aa8537
Commit
99aa8537
authored
May 12, 2021
by
Sumaiyya Burney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes create and get tests
parent
90afae02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
PromotionsControllerTest.java
...scend/promotions/controller/PromotionsControllerTest.java
+4
-3
No files found.
src/test/java/com/nisum/ascend/promotions/controller/PromotionsControllerTest.java
View file @
99aa8537
...
...
@@ -17,6 +17,7 @@ import reactor.core.publisher.Mono;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Random
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
...
...
@@ -66,7 +67,9 @@ class PromotionsControllerTest {
@Test
void
createPromotion
(){
Promotion
promotion
=
new
Promotion
(
"50OFF"
,
"SH1234"
,
(
float
)
0.5
,
5
);
Random
rd
=
new
Random
();
String
newPromoId
=
Integer
.
toString
(
rd
.
nextInt
());
Promotion
promotion
=
new
Promotion
(
newPromoId
,
"AFP-1"
,
0.5f
,
5
);
webTestClient
.
post
().
uri
(
"/api/promos"
)
.
contentType
(
MediaType
.
valueOf
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
body
(
Mono
.
just
(
promotion
),
Promotion
.
class
)
...
...
@@ -90,7 +93,6 @@ class PromotionsControllerTest {
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
expectBodyList
(
Promotion
.
class
)
.
hasSize
(
1
)
.
consumeWith
(
promo
->{
List
<
Promotion
>
promos
=
promo
.
getResponseBody
();
assert
promos
!=
null
;
...
...
@@ -106,7 +108,6 @@ class PromotionsControllerTest {
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
expectBodyList
(
Promotion
.
class
)
.
hasSize
(
2
)
.
consumeWith
(
promo
->{
List
<
Promotion
>
promos
=
promo
.
getResponseBody
();
assert
promos
!=
null
;
...
...
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