Remove @Digits annotation

This commit is contained in:
Arsh 2023-07-06 22:31:34 +05:30
parent 87c47746b4
commit d0123d9f80
2 changed files with 3 additions and 5 deletions

View file

@ -31,7 +31,6 @@ import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotEmpty;
/**
@ -57,8 +56,7 @@ public class Owner extends Person {
@Column(name = "telephone")
@NotEmpty
@Digits(fraction = 0, integer = 10)
@Pattern(regexp = "\\d{10,}", message = "Telephone must have at least 10 digits")
@Pattern(regexp = "\\d{10}", message = "Telephone must have 10 digits")
private String telephone;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)

View file

@ -113,7 +113,7 @@ class OwnerControllerTests {
.param("lastName", "Bloggs")
.param("address", "123 Caramel Street")
.param("city", "London")
.param("telephone", "01316761638"))
.param("telephone", "0131676163"))
.andExpect(status().is3xxRedirection());
}
@ -184,7 +184,7 @@ class OwnerControllerTests {
.param("lastName", "Bloggs")
.param("address", "123 Caramel Street")
.param("city", "London")
.param("telephone", "01616291589"))
.param("telephone", "0161629158"))
.andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/owners/{ownerId}"));
}