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 after() method in the {@link Date} class. |
|
29 */ |
|
30 public class after implements Testlet |
|
31 { |
|
32 /** |
|
33 * Runs the test using the specified harness. |
|
34 * |
|
35 * @param harness the test harness (<code>null</code> not permitted). |
|
36 */ |
|
37 public void test(TestHarness harness) |
|
38 { |
|
39 Date d1 = new Date(-1L); |
|
40 Date d2 = new Date(0L); |
|
41 Date d3 = new Date(1L); |
|
42 |
|
43 harness.check(!d1.after(d1)); |
|
44 harness.check(!d1.after(d2)); |
|
45 harness.check(!d1.after(d3)); |
|
46 harness.check(d2.after(d1)); |
|
47 harness.check(!d2.after(d2)); |
|
48 harness.check(!d2.after(d3)); |
|
49 harness.check(d3.after(d1)); |
|
50 harness.check(d3.after(d2)); |
|
51 harness.check(!d3.after(d3)); |
|
52 |
|
53 boolean pass = false; |
|
54 try |
|
55 { |
|
56 d1.after(null); |
|
57 } |
|
58 catch (NullPointerException e) |
|
59 { |
|
60 pass = true; |
|
61 } |
|
62 harness.check(pass); |
|
63 } |
|
64 |
|
65 } |
|