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 @PositiveOrZero
private OptionalInt numberOfOrders; private OptionalInt numberOfOrders;
@NotBlank
private Profile profile; private Profile profile;
public String getName() { public String getName() {

View File

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

View File

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

View File

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