Skip to content

Instantly share code, notes, and snippets.

@jgraglia
Created March 7, 2013 08:12

Revisions

  1. jgraglia created this gist Mar 7, 2013.
    29 changes: 29 additions & 0 deletions tests.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    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);
    }
    }