tests/libjava-mauve/src/gnu/testlet/java/util/GregorianCalendar/getMinimalDaysInFirstWeek.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.1
       
     2 
       
     3 // Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
       
     4 
       
     5 // Mauve is free software; you can redistribute it and/or modify
       
     6 // it under the terms of the GNU General Public License as published by
       
     7 // the Free Software Foundation; either version 2, or (at your option)
       
     8 // any later version.
       
     9 
       
    10 // Mauve is distributed in the hope that it will be useful,
       
    11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13 // GNU General Public License for more details.
       
    14 
       
    15 // You should have received a copy of the GNU General Public License
       
    16 // along with Mauve; see the file COPYING.  If not, write to
       
    17 // the Free Software Foundation, 59 Temple Place - Suite 330,
       
    18 // Boston, MA 02111-1307, USA.  */
       
    19 
       
    20 package gnu.testlet.java.util.GregorianCalendar;
       
    21 
       
    22 import gnu.testlet.TestHarness;
       
    23 import gnu.testlet.Testlet;
       
    24 
       
    25 import java.util.Calendar;
       
    26 import java.util.GregorianCalendar;
       
    27 import java.util.Locale;
       
    28 import java.util.TimeZone;
       
    29 
       
    30 /**
       
    31  * Some checks for the getMinimalDaysInFirstWeek() method in the 
       
    32  * {@link GregorianCalendar} class.
       
    33  */
       
    34 public class getMinimalDaysInFirstWeek implements Testlet 
       
    35 {
       
    36 
       
    37   /**
       
    38    * Runs the test using the specified harness.
       
    39    * 
       
    40    * @param harness  the test harness (<code>null</code> not permitted).
       
    41    */
       
    42   public void test(TestHarness harness)   
       
    43   {
       
    44     test10546(harness);
       
    45   }
       
    46   
       
    47   /**
       
    48    * A test to support Classpath bug report 10456.
       
    49    * 
       
    50    * @param harness  the test harness (<code>null</code> not permitted).
       
    51    */
       
    52   private void test10546(TestHarness harness) {
       
    53       
       
    54     Calendar c1 = new GregorianCalendar(TimeZone.getTimeZone("Europe/London"), Locale.UK);
       
    55     c1.clear();
       
    56     c1.set(Calendar.YEAR, 2005);
       
    57     c1.set(Calendar.WEEK_OF_YEAR, 1);
       
    58     c1.set(Calendar.DAY_OF_WEEK, c1.getFirstDayOfWeek());
       
    59     harness.check(c1.getMinimalDaysInFirstWeek(), 4);    
       
    60     
       
    61     Calendar c2 = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"), Locale.FRANCE);
       
    62     c2.clear();
       
    63     c2.set(Calendar.YEAR, 2005);
       
    64     c2.set(Calendar.WEEK_OF_YEAR, 1);
       
    65     c2.set(Calendar.DAY_OF_WEEK, c2.getFirstDayOfWeek());
       
    66     harness.check(c2.getMinimalDaysInFirstWeek(), 4);    
       
    67     
       
    68   }
       
    69 
       
    70 }