1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.urls; |
22 |
|
|
23 |
|
import jalview.util.UrlLink; |
24 |
|
|
25 |
|
import java.util.List; |
26 |
|
|
27 |
|
import org.testng.Assert; |
28 |
|
import org.testng.annotations.Test; |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (69) |
Complexity: 7 |
Complexity Density: 0.11 |
|
30 |
|
public class UrlLinkDisplayTest |
31 |
|
{ |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
33 |
1 |
@Test(groups = { "Functional" })... |
34 |
|
public void testDisplayColumnNames() |
35 |
|
{ |
36 |
|
|
37 |
1 |
List<String> names = UrlLinkDisplay.getDisplayColumnNames(); |
38 |
1 |
Assert.assertEquals(names.size(), 5); |
39 |
|
} |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
41 |
1 |
@Test(groups = { "Functional" })... |
42 |
|
public void getValue() |
43 |
|
{ |
44 |
1 |
UrlLink link = new UrlLink("Test Name", |
45 |
|
"http://identifiers.org/$DB_ACCESSION$", "TestDB"); |
46 |
1 |
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); |
47 |
|
|
48 |
1 |
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.PRIMARY)); |
49 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "Test"); |
50 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "TestDB"); |
51 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "Test Name"); |
52 |
1 |
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.SELECTED)); |
53 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.URL), |
54 |
|
"http://identifiers.org/$DB_ACCESSION$"); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
57 |
1 |
@Test(groups = { "Functional" })... |
58 |
|
public void testIsEditable() |
59 |
|
{ |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
1 |
UrlLink link = new UrlLink("Test Url", |
64 |
|
"http://identifiers.org/$DB_ACCESSION$", "TestName"); |
65 |
1 |
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); |
66 |
|
|
67 |
1 |
Assert.assertFalse(u.isEditable(UrlLinkDisplay.PRIMARY)); |
68 |
1 |
Assert.assertTrue(u.isEditable(UrlLinkDisplay.SELECTED)); |
69 |
1 |
Assert.assertFalse(u.isEditable(UrlLinkDisplay.ID)); |
70 |
1 |
Assert.assertFalse(u.isEditable(UrlLinkDisplay.URL)); |
71 |
1 |
Assert.assertFalse(u.isEditable(UrlLinkDisplay.NAME)); |
72 |
1 |
Assert.assertFalse(u.isEditable(UrlLinkDisplay.DATABASE)); |
73 |
|
|
74 |
1 |
UrlLink vlink = new UrlLink("Test Sequence ID Url", |
75 |
|
"http://myurl/$SEQUENCE_ID$", "TestName"); |
76 |
1 |
UrlLinkDisplay v = new UrlLinkDisplay("Test", vlink, false, false); |
77 |
|
|
78 |
1 |
Assert.assertTrue(v.isEditable(UrlLinkDisplay.PRIMARY)); |
79 |
1 |
Assert.assertTrue(v.isEditable(UrlLinkDisplay.SELECTED)); |
80 |
1 |
Assert.assertFalse(v.isEditable(UrlLinkDisplay.ID)); |
81 |
1 |
Assert.assertFalse(v.isEditable(UrlLinkDisplay.URL)); |
82 |
1 |
Assert.assertFalse(v.isEditable(UrlLinkDisplay.NAME)); |
83 |
1 |
Assert.assertFalse(v.isEditable(UrlLinkDisplay.DATABASE)); |
84 |
|
} |
85 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
86 |
1 |
@Test(groups = { "Functional" })... |
87 |
|
public void testName() |
88 |
|
{ |
89 |
1 |
UrlLink link = new UrlLink("Test Url", |
90 |
|
"http://identifiers.org/$DB_ACCESSION$", "TestName"); |
91 |
1 |
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); |
92 |
|
|
93 |
|
|
94 |
1 |
Assert.assertEquals(u.getDBName(), "TestName"); |
95 |
|
|
96 |
|
|
97 |
1 |
u.setDBName("NewName"); |
98 |
1 |
Assert.assertEquals(u.getDBName(), "NewName"); |
99 |
|
} |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
101 |
1 |
@Test(groups = { "Functional" })... |
102 |
|
public void testDescription() |
103 |
|
{ |
104 |
1 |
UrlLink link = new UrlLink("Test Name", |
105 |
|
"http://identifiers.org/$DB_ACCESSION$", "TestDB"); |
106 |
1 |
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); |
107 |
|
|
108 |
|
|
109 |
1 |
Assert.assertEquals(u.getDescription(), "Test Name"); |
110 |
|
|
111 |
|
|
112 |
1 |
u.setDescription("New Desc"); |
113 |
1 |
Assert.assertEquals(u.getDescription(), "New Desc"); |
114 |
|
} |
115 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
116 |
1 |
@Test(groups = { "Functional" })... |
117 |
|
public void testUrl() |
118 |
|
{ |
119 |
1 |
UrlLink link = new UrlLink("Test Name", |
120 |
|
"http://identifiers.org/$DB_ACCESSION$", "TestDB"); |
121 |
1 |
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); |
122 |
|
|
123 |
|
|
124 |
1 |
Assert.assertEquals(u.getUrl(), |
125 |
|
"http://identifiers.org/$DB_ACCESSION$"); |
126 |
|
|
127 |
|
|
128 |
1 |
u.setUrl("http://something.new/$SEQUENCE_ID$"); |
129 |
1 |
Assert.assertEquals(u.getUrl(), "http://something.new/$SEQUENCE_ID$"); |
130 |
|
} |
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
132 |
1 |
@Test(groups = { "Functional" })... |
133 |
|
public void testGetSetValue() |
134 |
|
{ |
135 |
1 |
UrlLink link = new UrlLink("Test Name", |
136 |
|
"http://identifiers.org/$DB_ACCESSION$", "TestDB"); |
137 |
1 |
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); |
138 |
|
|
139 |
1 |
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.PRIMARY)); |
140 |
1 |
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.SELECTED)); |
141 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "TestDB"); |
142 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "Test Name"); |
143 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "Test"); |
144 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.URL), |
145 |
|
"http://identifiers.org/$DB_ACCESSION$"); |
146 |
|
|
147 |
1 |
u.setValue(UrlLinkDisplay.PRIMARY, true); |
148 |
1 |
Assert.assertTrue((boolean) u.getValue(UrlLinkDisplay.PRIMARY)); |
149 |
|
|
150 |
1 |
u.setValue(UrlLinkDisplay.SELECTED, true); |
151 |
1 |
Assert.assertTrue((boolean) u.getValue(UrlLinkDisplay.SELECTED)); |
152 |
|
|
153 |
1 |
u.setValue(UrlLinkDisplay.NAME, "New Desc"); |
154 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "New Desc"); |
155 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "New Desc"); |
156 |
|
|
157 |
1 |
u.setValue(UrlLinkDisplay.DATABASE, "NewName"); |
158 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "NewName"); |
159 |
|
|
160 |
1 |
u.setValue(UrlLinkDisplay.ID, "New ID"); |
161 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "New ID"); |
162 |
|
|
163 |
1 |
u.setValue(UrlLinkDisplay.URL, "http://something.new/$SEQUENCE_ID$"); |
164 |
1 |
Assert.assertEquals(u.getValue(UrlLinkDisplay.URL), |
165 |
|
"http://something.new/$SEQUENCE_ID$"); |
166 |
|
} |
167 |
|
} |