1 /* setTime.java -- some checks for the setTime() method in the Calendar class. |
|
2 Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com> |
|
3 This file is part of Mauve. |
|
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, but |
|
11 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 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 the |
|
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 02110-1301 USA. |
|
19 |
|
20 */ |
|
21 |
|
22 // Tags: JDK1.1 |
|
23 |
|
24 package gnu.testlet.java.util.Calendar; |
|
25 |
|
26 import gnu.testlet.TestHarness; |
|
27 import gnu.testlet.Testlet; |
|
28 |
|
29 import java.util.Calendar; |
|
30 import java.util.Date; |
|
31 |
|
32 public class setTime implements Testlet |
|
33 { |
|
34 public void test(TestHarness harness) |
|
35 { |
|
36 Calendar c = Calendar.getInstance(); |
|
37 c.setTime(new Date(123L)); |
|
38 harness.check(c.getTimeInMillis(), 123L); |
|
39 |
|
40 // try null |
|
41 boolean pass = false; |
|
42 try |
|
43 { |
|
44 c.setTime(null); |
|
45 } |
|
46 catch (NullPointerException e) |
|
47 { |
|
48 pass = true; |
|
49 } |
|
50 harness.check(pass); |
|
51 } |
|
52 } |
|