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
297582f7
Commit
297582f7
authored
May 10, 2021
by
Sumaiyya Burney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes some typos/merge conflict errors
parent
d7bab1e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
11 deletions
+3
-11
RestWebExceptionHandler.java
.../ascend/promotions/exception/RestWebExceptionHandler.java
+0
-11
PromotionsControllerTest.java
...scend/promotions/controller/PromotionsControllerTest.java
+3
-0
No files found.
src/main/java/com/nisum/ascend/promotions/exception/RestWebExceptionHandler.java
View file @
297582f7
...
...
@@ -25,16 +25,6 @@ class RestWebExceptionHandler implements WebExceptionHandler {
// marks the response as complete and forbids writing to it
return
exchange
.
getResponse
().
writeWith
(
Flux
.
just
(
buffer
));
}
return
Mono
.
error
(
ex
);
}
}
@Component
@Order
(-
2
)
class
RestWebExceptionHandler
implements
WebExceptionHandler
{
@Override
public
Mono
<
Void
>
handle
(
ServerWebExchange
exchange
,
Throwable
ex
)
{
if
(
ex
instanceof
PromotionAlreadyExistsException
)
{
exchange
.
getResponse
().
setStatusCode
(
HttpStatus
.
NOT_ACCEPTABLE
);
...
...
@@ -42,5 +32,4 @@ class RestWebExceptionHandler implements WebExceptionHandler {
}
return
Mono
.
error
(
ex
);
}
}
src/test/java/com/nisum/ascend/promotions/controller/PromotionsControllerTest.java
View file @
297582f7
package
com
.
nisum
.
ascend
.
promotions
.
controller
;
import
com.nisum.ascend.promotions.dto.PromotionDto
;
import
com.nisum.ascend.promotions.model.Promotion
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
...
...
@@ -62,7 +63,9 @@ class PromotionsControllerTest {
.
expectHeader
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)
.
expectBody
()
.
jsonPath
(
"promotionId"
,
"0003"
);
}
@Test
void
createPromotion
(){
Promotion
promotion
=
new
Promotion
(
"50OFF"
,
"SH1234"
,
(
float
)
0.5
,
5
);
webTestClient
.
post
().
uri
(
"/api/promos"
)
...
...
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