01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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
34: TestObjectStringConverters {
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(
50: "EEE MMM dd HH:mm:sss yyyy");
51: Calendar calendar = Calendar.getInstance();
52: calendar.set(1980, 11, 9, 5, 0, 0);
53: java.util.Date date = calendar.getTime();
54: String formatted = format.format(date);
55: assertEquals("Locale dependent conversions",
56: "mar. d\u00E9c. 09 05:00:000 1980", formatted);
57:
58: }
59: }
|