Commit 297582f7 authored by Sumaiyya Burney's avatar Sumaiyya Burney

Fixes some typos/merge conflict errors

parent d7bab1e6
...@@ -25,16 +25,6 @@ class RestWebExceptionHandler implements WebExceptionHandler { ...@@ -25,16 +25,6 @@ class RestWebExceptionHandler implements WebExceptionHandler {
// marks the response as complete and forbids writing to it // marks the response as complete and forbids writing to it
return exchange.getResponse().writeWith(Flux.just(buffer)); 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) { if (ex instanceof PromotionAlreadyExistsException) {
exchange.getResponse().setStatusCode(HttpStatus.NOT_ACCEPTABLE); exchange.getResponse().setStatusCode(HttpStatus.NOT_ACCEPTABLE);
...@@ -42,5 +32,4 @@ class RestWebExceptionHandler implements WebExceptionHandler { ...@@ -42,5 +32,4 @@ class RestWebExceptionHandler implements WebExceptionHandler {
} }
return Mono.error(ex); return Mono.error(ex);
} }
} }
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;
...@@ -62,7 +63,9 @@ class PromotionsControllerTest { ...@@ -62,7 +63,9 @@ class PromotionsControllerTest {
.expectHeader().contentType(MediaType.APPLICATION_JSON_VALUE) .expectHeader().contentType(MediaType.APPLICATION_JSON_VALUE)
.expectBody() .expectBody()
.jsonPath("promotionId", "0003"); .jsonPath("promotionId", "0003");
}
@Test
void createPromotion(){ void createPromotion(){
Promotion promotion = new Promotion("50OFF","SH1234", (float) 0.5,5); Promotion promotion = new Promotion("50OFF","SH1234", (float) 0.5,5);
webTestClient.post().uri("/api/promos") webTestClient.post().uri("/api/promos")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment