KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > strategy > Testi18nObjectStringConversion


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16  
17 package org.apache.commons.betwixt.strategy;
18
19 import java.text.SimpleDateFormat JavaDoc;
20 import java.util.Calendar JavaDoc;
21 import java.util.Locale JavaDoc;
22
23 import junit.framework.Test;
24 import junit.framework.TestSuite;
25
26 /**
27  * Tests ObjectStringConverters in FRENCH locale
28  *
29  * @author Robert Burrell Donkin
30  * @version $Id: Testi18nObjectStringConversion.java,v 1.7 2004/02/28 13:38:36 yoavs Exp $
31  */

32 public class Testi18nObjectStringConversion extends TestObjectStringConverters
33 {
34     static {
35         Locale.setDefault(Locale.FRENCH);
36     }
37
38     public static Test suite() {
39         return new TestSuite(Testi18nObjectStringConversion.class);
40     }
41     
42     public Testi18nObjectStringConversion(String JavaDoc testName) {
43         super(testName);
44     }
45
46     public void testFrenchDefaultLocale() throws Exception JavaDoc {
47         //check locale has been changed
48
SimpleDateFormat JavaDoc format = new SimpleDateFormat JavaDoc("EEE MMM dd HH:mm:sss yyyy");
49         Calendar JavaDoc calendar = Calendar.getInstance();
50         calendar.set(1980, 11, 9, 5, 0, 0);
51         java.util.Date JavaDoc date = calendar.getTime();
52         String JavaDoc formatted = format.format(date);
53         assertEquals("Locale dependent conversions", "mar. d\u00E9c. 09 05:00:000 1980", formatted);
54         
55     }
56 }
Popular Tags