tests/libjava-mauve/src/gnu/testlet/java/util/Date/before.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) 2005 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.Date;
       
    21 
       
    22 import gnu.testlet.TestHarness;
       
    23 import gnu.testlet.Testlet;
       
    24 
       
    25 import java.util.Date;
       
    26 
       
    27 /**
       
    28  * Some checks for the before() method in the {@link Date} class.
       
    29  */
       
    30 public class before implements Testlet 
       
    31 {
       
    32 
       
    33   /**
       
    34    * Runs the test using the specified harness.
       
    35    * 
       
    36    * @param harness  the test harness (<code>null</code> not permitted).
       
    37    */
       
    38   public void test(TestHarness harness)   
       
    39   {
       
    40     Date d1 = new Date(-1L);
       
    41     Date d2 = new Date(0L);
       
    42     Date d3 = new Date(1L);
       
    43 
       
    44     harness.check(!d1.before(d1));
       
    45     harness.check(d1.before(d2));
       
    46     harness.check(d1.before(d3));
       
    47     harness.check(!d2.before(d1));
       
    48     harness.check(!d2.before(d2));
       
    49     harness.check(d2.before(d3));
       
    50     harness.check(!d3.before(d1));
       
    51     harness.check(!d3.before(d2));
       
    52     harness.check(!d3.before(d3));
       
    53  
       
    54     boolean pass = false;
       
    55     try
       
    56     {
       
    57       d1.before(null);   
       
    58     }
       
    59     catch (NullPointerException e)
       
    60     {
       
    61       pass = true;
       
    62     }
       
    63     harness.check(pass);
       
    64   }
       
    65 
       
    66 }