Skip to content

Commit

Permalink
HV-543 Fixing typo in French message bundle and updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hferentschik committed Dec 16, 2011
1 parent fd1646a commit cddf9cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ javax.validation.constraints.Pattern.message = doit suivre "{regexp}"
javax.validation.constraints.Size.message = la taille doit \u00EAtre entre {min} et {max}

org.hibernate.validator.constraints.CreditCardNumber.message = Num\u00E9ro de carte de cr\u00E9dit invalide
org.hibernate.validator.constraints.Email.message = Addresse email mal form\u00E9e
org.hibernate.validator.constraints.Email.message = Adresse email mal form\u00E9e
org.hibernate.validator.constraints.Length.message = la taille doit \u00EAtre entre {min} et {max}
org.hibernate.validator.constraints.NotBlank.message = ne peut pas \u00EAtre vide
org.hibernate.validator.constraints.NotEmpty.message = ne peut pas \u00EAtre vide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.testng.annotations.Test;

import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
import org.hibernate.validator.testutil.TestForIssue;
import org.hibernate.validator.testutil.ValidatorUtil;

import static org.hibernate.validator.testutil.ConstraintViolationAssert.assertCorrectConstraintViolationMessages;
Expand All @@ -51,10 +52,8 @@ public void restoreDefaultLocale() {
Locale.setDefault( defaultLocale );
}

/**
* HV-268
*/
@Test
@TestForIssue(jiraKey = "HV-268")
public void testEmailAndRangeMessageEnglishLocale() {
Configuration<?> config = ValidatorUtil.getConfiguration( Locale.ENGLISH );
config.messageInterpolator( new ResourceBundleMessageInterpolator() );
Expand All @@ -69,10 +68,8 @@ public void testEmailAndRangeMessageEnglishLocale() {
);
}

/**
* HV-268
*/
@Test
@TestForIssue(jiraKey = "HV-268")
public void testEmailAndRangeMessageGermanLocale() {
Configuration<?> config = ValidatorUtil.getConfiguration( Locale.GERMAN );
config.messageInterpolator( new ResourceBundleMessageInterpolator() );
Expand All @@ -87,10 +84,8 @@ public void testEmailAndRangeMessageGermanLocale() {
);
}

/**
* HV-268
*/
@Test
@TestForIssue(jiraKey = "HV-268")
public void testEmailAndRangeMessageFrenchLocale() {
Configuration<?> config = ValidatorUtil.getConfiguration( Locale.FRENCH );
config.messageInterpolator( new ResourceBundleMessageInterpolator() );
Expand All @@ -101,7 +96,7 @@ public void testEmailAndRangeMessageFrenchLocale() {
Set<ConstraintViolation<User>> constraintViolations = validator.validate( user );
assertNumberOfViolations( constraintViolations, 2 );
assertCorrectConstraintViolationMessages(
constraintViolations, "Addresse email mal form\u00E9e", "doit \u00EAtre entre 18 et 21"
constraintViolations, "Adresse email mal form\u00E9e", "doit \u00EAtre entre 18 et 21"
);
}

Expand All @@ -110,6 +105,7 @@ public void testEmailAndRangeMessageFrenchLocale() {
* must take precedence over the system's default locale.
*/
@Test
@TestForIssue(jiraKey = "HV-306")
public void testThatExplicitlySetEnglishLocaleHasPrecedenceOverDefaultLocale() {
Configuration<?> config = ValidatorUtil.getConfiguration( Locale.FRENCH );
config.messageInterpolator( new LocalizedMessageInterpolator( Locale.ENGLISH ) );
Expand Down

0 comments on commit cddf9cb

Please sign in to comment.