| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.qedeq.base.utility; |
| 17 |
|
|
| 18 |
|
import org.qedeq.base.test.QedeqTestCase; |
| 19 |
|
|
| 20 |
|
|
| 21 |
|
@link |
| 22 |
|
|
| 23 |
|
@author |
| 24 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (41) |
Complexity: 6 |
Complexity Density: 0.17 |
|
| 25 |
|
public class DateUtilityTest extends QedeqTestCase { |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
@see |
| 29 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 30 |
4
|
protected void setUp() throws Exception {... |
| 31 |
4
|
super.setUp(); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
@see |
| 36 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 37 |
4
|
protected void tearDown() throws Exception {... |
| 38 |
4
|
super.tearDown(); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
@throws |
| 45 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1
PASS
|
|
| 46 |
1
|
public void testGetDuration() throws Exception {... |
| 47 |
1
|
assertEquals("00:00:00.000", DateUtility.getDuration(0)); |
| 48 |
1
|
assertEquals("00:00:00.001", DateUtility.getDuration(1)); |
| 49 |
1
|
assertEquals("23:59:59.999", DateUtility.getDuration(1000 * 60 * 60 * 24 - 1)); |
| 50 |
1
|
assertEquals("1 day 00:00:00.000", DateUtility.getDuration(1000 * 60 * 60 * 24)); |
| 51 |
1
|
assertEquals("1 day 23:59:59.999", DateUtility.getDuration(1000 * 60 * 60 * 24 * 2 - 1)); |
| 52 |
1
|
assertEquals("2 days 00:00:00.000", DateUtility.getDuration(1000 * 60 * 60 * 24 * 2)); |
| 53 |
1
|
assertEquals("365 days 00:00:00.000", DateUtility.getDuration(1000L * 60 * 60 * 24 * 365)); |
| 54 |
1
|
assertEquals("22:59:59.999", DateUtility.getDuration(1000 * 60 * 60 * 24 - 1 - 60 * 60 |
| 55 |
|
* 1000)); |
| 56 |
1
|
assertEquals("23:00:59.999", DateUtility.getDuration(1000 * 60 * 60 * 24 - 1 - 60 * 60 |
| 57 |
|
* 1000 + 60 * 1000)); |
| 58 |
|
} |
| 59 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1
PASS
|
|
| 60 |
1
|
public void testGetIsoTimestamp() throws Exception {... |
| 61 |
1
|
final String ts = DateUtility.getIsoTimestamp(); |
| 62 |
1
|
assertEquals("2009-06-07T02:10:12.000".length(), ts.length()); |
| 63 |
1
|
assertEquals("-", ts.substring(4, 5)); |
| 64 |
1
|
assertEquals("-", ts.substring(7, 8)); |
| 65 |
1
|
assertEquals("T", ts.substring(10, 11)); |
| 66 |
1
|
assertEquals(":", ts.substring(13, 14)); |
| 67 |
1
|
assertEquals(":", ts.substring(16, 17)); |
| 68 |
1
|
assertEquals(".", ts.substring(19, 20)); |
| 69 |
|
} |
| 70 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1
PASS
|
|
| 71 |
1
|
public void testGmtTimestamp() throws Exception {... |
| 72 |
1
|
final String ts = DateUtility.getGmtTimestamp(); |
| 73 |
1
|
assertEquals("2009-06-07 02:10:12.000".length(), ts.length()); |
| 74 |
1
|
assertEquals("-", ts.substring(4, 5)); |
| 75 |
1
|
assertEquals("-", ts.substring(7, 8)); |
| 76 |
1
|
assertEquals(" ", ts.substring(10, 11)); |
| 77 |
1
|
assertEquals(":", ts.substring(13, 14)); |
| 78 |
1
|
assertEquals(":", ts.substring(16, 17)); |
| 79 |
1
|
assertEquals(".", ts.substring(19, 20)); |
| 80 |
|
} |
| 81 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1
PASS
|
|
| 82 |
1
|
public void testTimestamp() throws Exception {... |
| 83 |
1
|
final String ts = DateUtility.getTimestamp(); |
| 84 |
1
|
assertEquals("2009-06-07 02:10:12.000".length(), ts.length()); |
| 85 |
1
|
assertEquals("-", ts.substring(4, 5)); |
| 86 |
1
|
assertEquals("-", ts.substring(7, 8)); |
| 87 |
1
|
assertEquals(" ", ts.substring(10, 11)); |
| 88 |
1
|
assertEquals(":", ts.substring(13, 14)); |
| 89 |
1
|
assertEquals(":", ts.substring(16, 17)); |
| 90 |
1
|
assertEquals(".", ts.substring(19, 20)); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
} |