Skip to content

Commit

Permalink
#13 Changing by decimal validator
Browse files Browse the repository at this point in the history
  • Loading branch information
josdem committed Sep 8, 2023
1 parent 8c00be0 commit 5800ed8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spotless {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation "org.springdoc:springdoc-openapi-starter-webflux-ui:$springDocVersion"
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/josdem/catcher/model/Product.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.josdem.catcher.model;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.DecimalMin;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -13,6 +13,6 @@ public class Product {

private String name;

@Min(1)
@DecimalMin(value = "0", inclusive = false)
private BigDecimal price;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class StatusControllerTest {

private final WebTestClient webTestClient;
private final Product product = new Product("PIZZA", new BigDecimal("0.00"));
private final Product product = new Product("PIZZA", new BigDecimal("15.99"));

@Test
@DisplayName("it stores status")
Expand Down

0 comments on commit 5800ed8

Please sign in to comment.