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;
20  import java.util.Calendar;
21  import java.util.Locale;
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 155402 2005-02-26 12:52:00Z dirkv $
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 testName) {
43          super(testName);
44      }
45  
46      public void testFrenchDefaultLocale() throws Exception {
47          //check locale has been changed
48          SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:sss yyyy");
49          Calendar calendar = Calendar.getInstance();
50          calendar.set(1980, 11, 9, 5, 0, 0);
51          java.util.Date date = calendar.getTime();
52          String formatted = format.format(date);
53          assertEquals("Locale dependent conversions", "mar. d\u00E9c. 09 05:00:000 1980", formatted);
54          
55      }
56  }