Re-enabled a disabled test and made the tests independent of machine locale

This commit is contained in:
Martin van Wingerden 2019-10-02 13:58:31 +02:00
parent 86dd449968
commit 5aba544fb8
No known key found for this signature in database
GPG Key ID: 6DB72288DF1725E3
4 changed files with 8 additions and 1 deletions

View File

@ -20,6 +20,7 @@ public class Customer {
@PositiveOrZero
private OptionalInt numberOfOrders;
@NotBlank
private Profile profile;
public String getName() {

View File

@ -76,7 +76,7 @@ public class ContainerValidationIntegrationTest {
assertEquals(0, violations.size());
}
// @Test
@Test
public void whenProfileCompanyNameBlank_thenValidationFails() {
Customer customer = new Customer();
customer.setName("John");

View File

@ -3,6 +3,7 @@ package org.baeldung.javabeanconstraints.bigdecimal;
import static org.assertj.core.api.Assertions.assertThat;
import java.math.BigDecimal;
import java.util.Locale;
import java.util.Set;
import javax.validation.ConstraintViolation;
@ -18,6 +19,8 @@ public class InvoiceUnitTest {
@BeforeClass
public static void setupValidatorInstance() {
Locale.setDefault(Locale.US);
validator = Validation.buildDefaultValidatorFactory()
.getValidator();
}

View File

@ -2,6 +2,7 @@ package org.baeldung.javabeanconstraints.validationgroup;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Locale;
import java.util.Set;
import javax.validation.ConstraintViolation;
@ -16,6 +17,8 @@ public class RegistrationFormUnitTest {
@BeforeClass
public static void setupValidatorInstance() {
Locale.setDefault(Locale.US);
validator = Validation.buildDefaultValidatorFactory()
.getValidator();
}