Added test case for getDateInstance(int, Locale).

Removed whitespaces from lines that was supposed to be empty.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137771 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Fredrik Westermarck 2004-02-04 18:49:10 +00:00
parent 644fcb88d3
commit d1b0159e59
1 changed files with 35 additions and 18 deletions

View File

@ -1,7 +1,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* Copyright (c) 2002-2004 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -54,6 +54,7 @@
package org.apache.commons.lang.time;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
@ -69,8 +70,9 @@ import junit.textui.TestRunner;
*
* @author Sean Schofield
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Fredrik Westermarck
* @since 2.0
* @version $Id: FastDateFormatTest.java,v 1.6 2003/08/18 02:22:28 bayard Exp $
* @version $Id: FastDateFormatTest.java,v 1.7 2004/02/04 18:49:10 fredrik Exp $
*/
public class FastDateFormatTest extends TestCase {
@ -246,4 +248,19 @@ public class FastDateFormatTest extends TestCase {
}
}
/**
* Test case for {@link FastDateFormat#getDateInstance(int, java.util.Locale)}.
*/
public void testShortDateStyleWithLocales() {
Locale usLocale = Locale.US;
Locale swedishLocale = new Locale("sv", "SE");
Calendar cal = Calendar.getInstance();
cal.set(2004, 1, 3);
FastDateFormat fdf = FastDateFormat.getDateInstance(FastDateFormat.SHORT, usLocale);
assertEquals("2/3/04", fdf.format(cal));
fdf = FastDateFormat.getDateInstance(FastDateFormat.SHORT, swedishLocale);
assertEquals("2004-02-03", fdf.format(cal));
}
}