1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.bin; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
|
25 |
|
import jalview.gui.JvOptionPane; |
26 |
|
|
27 |
|
import java.text.SimpleDateFormat; |
28 |
|
import java.util.Date; |
29 |
|
import java.util.Locale; |
30 |
|
|
31 |
|
import org.testng.annotations.AfterClass; |
32 |
|
import org.testng.annotations.BeforeClass; |
33 |
|
import org.testng.annotations.Test; |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
35 |
|
public class CacheTest |
36 |
|
{ |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
38 |
1 |
@BeforeClass(alwaysRun = true)... |
39 |
|
public void setUpJvOptionPane() |
40 |
|
{ |
41 |
1 |
JvOptionPane.setInteractiveMode(false); |
42 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
43 |
|
} |
44 |
|
|
45 |
|
private Locale locale; |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
1 |
@BeforeClass(alwaysRun = true)... |
48 |
|
public void setUpBeforeClass() |
49 |
|
{ |
50 |
1 |
locale = Locale.getDefault(); |
51 |
|
} |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
1 |
@AfterClass(alwaysRun = true)... |
54 |
|
public void tearDownAfterClass() |
55 |
|
{ |
56 |
1 |
Locale.setDefault(locale); |
57 |
|
} |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
62 |
1 |
@Test(groups = "Functional")... |
63 |
|
public void testSetDateProperty() |
64 |
|
{ |
65 |
1 |
Date now = new Date(); |
66 |
1 |
Locale.setDefault(Locale.FRENCH); |
67 |
1 |
String formattedDate = Cache.setDateProperty("test", now); |
68 |
1 |
Locale.setDefault(Locale.UK); |
69 |
1 |
String formattedDate2 = Cache.setDateProperty("test", now); |
70 |
1 |
assertEquals(formattedDate, formattedDate2); |
71 |
|
|
72 |
|
|
73 |
1 |
assertEquals( |
74 |
|
formattedDate2, |
75 |
|
SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.MEDIUM, |
76 |
|
SimpleDateFormat.MEDIUM, Locale.UK).format(now)); |
77 |
|
} |
78 |
|
} |