|
9 | 9 |
|
10 | 10 | package net.jodah.failsafe.util;
|
11 | 11 |
|
12 |
| -import org.testng.annotations.Test; |
13 |
| - |
14 | 12 | import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
15 | 13 | import static java.util.concurrent.TimeUnit.SECONDS;
|
16 |
| - |
17 | 14 | import static org.testng.Assert.assertEquals;
|
18 | 15 | import static org.testng.Assert.assertNotEquals;
|
| 16 | +import static org.testng.Assert.assertTrue; |
19 | 17 |
|
20 |
| -@Test public class DurationTest |
21 |
| -{ |
22 |
| - |
23 |
| - //~ Methods ---------------------------------------------------------------- |
24 |
| - |
25 |
| - public void testEquals() |
26 |
| - throws Exception |
27 |
| - { |
28 |
| - assertEquals(new Duration(30000, MILLISECONDS), |
29 |
| - new Duration(30, SECONDS)); |
30 |
| - assertNotEquals(new Duration(30, MILLISECONDS), |
31 |
| - new Duration(30, SECONDS)); |
32 |
| - } |
33 |
| - |
34 |
| - @Test public void testHashCode() |
35 |
| - throws Exception |
36 |
| - { |
37 |
| - assertEquals(new Duration(30000, MILLISECONDS).hashCode(), |
38 |
| - new Duration(30, SECONDS).hashCode()); |
39 |
| - assertNotEquals(new Duration(30, MILLISECONDS).hashCode(), |
40 |
| - new Duration(30, SECONDS).hashCode()); |
41 |
| - } |
| 18 | +import org.testng.annotations.Test; |
42 | 19 |
|
43 |
| - @Test public void testToString() |
44 |
| - throws Exception |
45 |
| - { |
46 |
| - assertEquals(new Duration(30, SECONDS).toString(), |
47 |
| - "Duration{length=30, timeUnit=SECONDS}"); |
48 |
| - } |
| 20 | +@Test |
| 21 | +public class DurationTest { |
| 22 | + public void testEquals() throws Exception { |
| 23 | + assertTrue(!new Duration(30, SECONDS).equals(null)); |
| 24 | + assertEquals(new Duration(30000, MILLISECONDS), new Duration(30, SECONDS)); |
| 25 | + assertNotEquals(new Duration(30, MILLISECONDS), new Duration(30, SECONDS)); |
| 26 | + } |
| 27 | + |
| 28 | + @Test |
| 29 | + public void testHashCode() throws Exception { |
| 30 | + assertEquals(new Duration(30000, MILLISECONDS).hashCode(), new Duration(30, SECONDS).hashCode()); |
| 31 | + assertNotEquals(new Duration(30, MILLISECONDS).hashCode(), new Duration(30, SECONDS).hashCode()); |
| 32 | + } |
| 33 | + |
| 34 | + @Test |
| 35 | + public void testToString() throws Exception { |
| 36 | + assertEquals(new Duration(30, SECONDS).toString(), "30 seconds"); |
| 37 | + } |
49 | 38 | }
|
0 commit comments