From 076a124e0a643e2f471f873a1b4954a12e3b08ae Mon Sep 17 00:00:00 2001 From: Antoine Rey Date: Mon, 24 Feb 2014 14:05:02 +0100 Subject: [PATCH] Fixes #37 with other default locale than english MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test in error with french default Locale: org.junit.ComparisonFailure: expected:<[ne peut pas ĂȘtre vide]> but was:<[may not be empty]> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.springframework.samples.petclinic.model.ValidatorTests.emptyFirstName(ValidatorTests.java:39) --- .../samples/petclinic/model/ValidatorTests.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java b/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java index 354c15a9f..9d1e882dd 100644 --- a/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java +++ b/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java @@ -1,5 +1,6 @@ package org.springframework.samples.petclinic.model; +import java.util.Locale; import java.util.Set; import javax.validation.ConstraintViolation; @@ -10,6 +11,7 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; @@ -32,6 +34,7 @@ public class ValidatorTests { @Test public void emptyFirstName() { + LocaleContextHolder.setLocale(Locale.ENGLISH); Person person = new Person(); person.setFirstName(""); person.setLastName("smith");