Created
March 7, 2013 08:12
-
-
Save jgraglia/5106368 to your computer and use it in GitHub Desktop.
CloudSeal parse date of birth probleam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.Locale; | |
import org.junit.Assert; | |
import org.junit.Test; | |
import com.cloudseal.client.saml2.CloudsealPrincipal; | |
/** @see CloudsealPrincipal#setDateOfBirth(String)*/ | |
public class DateOfBirthTest { | |
private final String DATE_OF_BIRTH = "Sat Oct 12 00:00:00 UTC 1978"; | |
@Test | |
public void date_of_birth_cannot_be_parsed_with_my_default_french_locale() throws ParseException { | |
Assert.assertEquals(Locale.FRANCE, Locale.getDefault()); | |
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( | |
"EEE MMM dd HH:mm:ss z yyyy"); | |
Date dob = simpleDateFormat.parse(DATE_OF_BIRTH); | |
} | |
@Test | |
public void date_of_birth_must_be_parsed_as_with_en_locale() throws ParseException { | |
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( | |
"EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); | |
Date dob = simpleDateFormat.parse(DATE_OF_BIRTH); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment