1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */ 
17   
18  package org.apache.commons.betwixt.strategy;
19  
20  import java.text.SimpleDateFormat;
21  import java.util.Calendar;
22  import java.util.Locale;
23  
24  import junit.framework.Test;
25  import junit.framework.TestSuite;
26  
27  /**
28   * Tests ObjectStringConverters in FRENCH locale
29   * 
30   * @author Robert Burrell Donkin
31   * @version $Id: Testi18nObjectStringConversion.java 438373 2006-08-30 05:17:21Z bayard $
32   */
33  public class Testi18nObjectStringConversion extends TestObjectStringConverters
34  {    
35      static {
36          Locale.setDefault(Locale.FRENCH);
37      }
38  
39      public static Test suite() {
40          return new TestSuite(Testi18nObjectStringConversion.class);
41      }
42      
43      public Testi18nObjectStringConversion(String testName) {
44          super(testName);
45      }
46  
47      public void testFrenchDefaultLocale() throws Exception {
48          //check locale has been changed
49          SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:sss yyyy");
50          Calendar calendar = Calendar.getInstance();
51          calendar.set(1980, 11, 9, 5, 0, 0);
52          java.util.Date date = calendar.getTime();
53          String formatted = format.format(date);
54          assertEquals("Locale dependent conversions", "mar. d\u00E9c. 09 05:00:000 1980", formatted);
55          
56      }
57  }