1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.name;
|
11
|
|
12
|
import static org.junit.Assert.*;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
import org.junit.After;
|
16
|
import org.junit.AfterClass;
|
17
|
import org.junit.Before;
|
18
|
import org.junit.BeforeClass;
|
19
|
import org.junit.Ignore;
|
20
|
import org.junit.Test;
|
21
|
|
22
|
import eu.etaxonomy.cdm.model.agent.Team;
|
23
|
import eu.etaxonomy.cdm.model.reference.Article;
|
24
|
import eu.etaxonomy.cdm.test.unit.EntityTestBase;
|
25
|
|
26
|
/**
|
27
|
* @author a.mueller
|
28
|
*
|
29
|
*/
|
30
|
public class NonViralNameTest extends EntityTestBase {
|
31
|
private static Logger logger = Logger.getLogger(NonViralNameTest.class);
|
32
|
|
33
|
|
34
|
NonViralName<NonViralName> nonViralName1;
|
35
|
NonViralName<NonViralName> nonViralName2;
|
36
|
|
37
|
/**
|
38
|
* @throws java.lang.Exception
|
39
|
*/
|
40
|
@BeforeClass
|
41
|
public static void setUpBeforeClass() throws Exception {
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* @throws java.lang.Exception
|
46
|
*/
|
47
|
@AfterClass
|
48
|
public static void tearDownAfterClass() throws Exception {
|
49
|
}
|
50
|
|
51
|
/**
|
52
|
* @throws java.lang.Exception
|
53
|
*/
|
54
|
@Before
|
55
|
public void setUp() throws Exception {
|
56
|
nonViralName1 = new NonViralName<NonViralName>();
|
57
|
nonViralName2 = new NonViralName<NonViralName>();
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* @throws java.lang.Exception
|
62
|
*/
|
63
|
@After
|
64
|
public void tearDown() throws Exception {
|
65
|
}
|
66
|
|
67
|
// ******************* TESTS ***********************************/
|
68
|
|
69
|
/**
|
70
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#generateTitle()}.
|
71
|
*/
|
72
|
@Test
|
73
|
public final void testGenerateTitle() {
|
74
|
String fullName = "Abies alba subsp. beta (L.) Mill.";
|
75
|
nonViralName1.setGenusOrUninomial("Genus");
|
76
|
nonViralName1.setSpecificEpithet("spec");
|
77
|
nonViralName1.setRank(Rank.SPECIES());
|
78
|
assertEquals("Genus spec", nonViralName1.generateTitle());
|
79
|
assertEquals("", nonViralName2.generateTitle());
|
80
|
}
|
81
|
|
82
|
/**
|
83
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#isCodeCompliant()}.
|
84
|
*/
|
85
|
@Test
|
86
|
public final void testIsCodeCompliant() {
|
87
|
logger.warn("Not yet implemented"); // TODO
|
88
|
}
|
89
|
|
90
|
/**
|
91
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#NonViralName()}.
|
92
|
*/
|
93
|
@Test
|
94
|
public final void testNonViralName() {
|
95
|
assertNotNull(nonViralName1);
|
96
|
}
|
97
|
|
98
|
/**
|
99
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#NonViralName(eu.etaxonomy.cdm.model.name.Rank)}.
|
100
|
*/
|
101
|
@Test
|
102
|
public final void testNonViralNameRank() {
|
103
|
NonViralName nonViralName = NonViralName.NewInstance(Rank.GENUS());
|
104
|
assertNotNull(nonViralName);
|
105
|
}
|
106
|
|
107
|
/**
|
108
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#NonViralName(eu.etaxonomy.cdm.model.name.Rank, java.lang.String, java.lang.String, java.lang.String, eu.etaxonomy.cdm.model.agent.Agent, eu.etaxonomy.cdm.model.reference.INomenclaturalReference, java.lang.String)}.
|
109
|
*/
|
110
|
@Test
|
111
|
public final void testNonViralNameRankStringStringStringAgentINomenclaturalReferenceString() {
|
112
|
Team agent = Team.NewInstance();
|
113
|
Article article = new Article();
|
114
|
HomotypicalGroup homotypicalGroup = HomotypicalGroup.NewInstance();
|
115
|
NonViralName nonViralName = new NonViralName<NonViralName>(Rank.GENUS(), "Genus", "species", "infraSpec", agent, article, "mikro", homotypicalGroup);
|
116
|
assertEquals("Genus", nonViralName.getGenusOrUninomial() );
|
117
|
assertEquals("species", nonViralName.getSpecificEpithet() );
|
118
|
assertEquals("infraSpec", nonViralName.getInfraSpecificEpithet());
|
119
|
assertEquals(agent, nonViralName.getCombinationAuthorTeam() );
|
120
|
assertEquals(article, nonViralName.getNomenclaturalReference() );
|
121
|
assertEquals("mikro", nonViralName.getNomenclaturalMicroReference() );
|
122
|
}
|
123
|
|
124
|
/**
|
125
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getCombinationAuthorTeam()}.
|
126
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#setCombinationAuthorTeam(eu.etaxonomy.cdm.model.agent.Agent)}.
|
127
|
*/
|
128
|
@Test
|
129
|
public final void testGetSetCombinationAuthorTeam() {
|
130
|
Team team1 = Team.NewInstance();
|
131
|
nonViralName1.setCombinationAuthorTeam(team1);
|
132
|
assertEquals(team1, nonViralName1.getCombinationAuthorTeam());
|
133
|
nonViralName1.setCombinationAuthorTeam(null);
|
134
|
assertEquals(null, nonViralName1.getCombinationAuthorTeam());
|
135
|
nonViralName2.setCombinationAuthorTeam(null);
|
136
|
assertEquals(null, nonViralName2.getCombinationAuthorTeam());
|
137
|
}
|
138
|
|
139
|
|
140
|
/**
|
141
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getExCombinationAuthorTeam()}.
|
142
|
*/
|
143
|
@Test
|
144
|
public final void testGetSetExCombinationAuthorTeam() {
|
145
|
Team team1 = Team.NewInstance();
|
146
|
nonViralName1.setExCombinationAuthorTeam(team1);
|
147
|
assertEquals(team1, nonViralName1.getExCombinationAuthorTeam());
|
148
|
nonViralName1.setExCombinationAuthorTeam(null);
|
149
|
assertEquals(null, nonViralName1.getExCombinationAuthorTeam());
|
150
|
nonViralName2.setExCombinationAuthorTeam(null);
|
151
|
assertEquals(null, nonViralName2.getExCombinationAuthorTeam());
|
152
|
}
|
153
|
|
154
|
|
155
|
/**
|
156
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getCombinationAuthorTeam()}.
|
157
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#setCombinationAuthorTeam(eu.etaxonomy.cdm.model.agent.Agent)}.
|
158
|
*/
|
159
|
@Test
|
160
|
public final void testGetSetBasionymAuthorTeam() {
|
161
|
Team team1 = Team.NewInstance();
|
162
|
nonViralName1.setBasionymAuthorTeam(team1);
|
163
|
assertEquals(team1, nonViralName1.getBasionymAuthorTeam());
|
164
|
nonViralName1.setBasionymAuthorTeam(null);
|
165
|
assertEquals(null, nonViralName1.getBasionymAuthorTeam());
|
166
|
nonViralName2.setBasionymAuthorTeam(null);
|
167
|
assertEquals(null, nonViralName2.getBasionymAuthorTeam());
|
168
|
}
|
169
|
|
170
|
|
171
|
/**
|
172
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getExCombinationAuthorTeam()}.
|
173
|
*/
|
174
|
@Test
|
175
|
public final void testGetSetExBasionymAuthorTeam() {
|
176
|
Team team1 = Team.NewInstance();
|
177
|
nonViralName1.setExBasionymAuthorTeam(team1);
|
178
|
assertEquals(team1, nonViralName1.getExBasionymAuthorTeam());
|
179
|
nonViralName1.setExBasionymAuthorTeam(null);
|
180
|
assertEquals(null, nonViralName1.getExBasionymAuthorTeam());
|
181
|
nonViralName2.setExBasionymAuthorTeam(null);
|
182
|
assertEquals(null, nonViralName2.getExBasionymAuthorTeam());
|
183
|
}
|
184
|
|
185
|
|
186
|
/**
|
187
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getGenusOrUninomial()}.
|
188
|
*/
|
189
|
@Test
|
190
|
public final void testGetSetGenusOrUninomial() {
|
191
|
nonViralName1.setGenusOrUninomial("Genus");
|
192
|
assertEquals("Genus", nonViralName1.getGenusOrUninomial());
|
193
|
nonViralName1.setGenusOrUninomial(null);
|
194
|
assertEquals(null, nonViralName1.getGenusOrUninomial());
|
195
|
nonViralName2.setGenusOrUninomial(null);
|
196
|
assertEquals(null, nonViralName2.getGenusOrUninomial());
|
197
|
}
|
198
|
|
199
|
/**
|
200
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getInfraGenericEpithet()}.
|
201
|
*/
|
202
|
@Test
|
203
|
public final void testGetSetInfraGenericEpithet() {
|
204
|
nonViralName1.setInfraGenericEpithet("InfraGenus");
|
205
|
assertEquals("InfraGenus", nonViralName1.getInfraGenericEpithet());
|
206
|
nonViralName1.setInfraGenericEpithet(null);
|
207
|
assertEquals(null, nonViralName1.getInfraGenericEpithet());
|
208
|
nonViralName2.setInfraGenericEpithet(null);
|
209
|
assertEquals(null, nonViralName2.getInfraGenericEpithet());
|
210
|
}
|
211
|
|
212
|
/**
|
213
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getSpecificEpithet()}.
|
214
|
*/
|
215
|
@Test
|
216
|
public final void testGetSetSpecificEpithet() {
|
217
|
nonViralName1.setSpecificEpithet("specEpi");
|
218
|
assertEquals("specEpi", nonViralName1.getSpecificEpithet());
|
219
|
nonViralName1.setSpecificEpithet(null);
|
220
|
assertEquals(null, nonViralName1.getSpecificEpithet());
|
221
|
nonViralName2.setSpecificEpithet(null);
|
222
|
assertEquals(null, nonViralName2.getSpecificEpithet());
|
223
|
}
|
224
|
|
225
|
/**
|
226
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getInfraSpecificEpithet()}.
|
227
|
*/
|
228
|
@Test
|
229
|
public final void testGetSetInfraSpecificEpithet() {
|
230
|
nonViralName1.setInfraSpecificEpithet("InfraSpecEpi");
|
231
|
assertEquals("InfraSpecEpi", nonViralName1.getInfraSpecificEpithet());
|
232
|
nonViralName1.setInfraSpecificEpithet(null);
|
233
|
assertEquals(null, nonViralName1.getInfraSpecificEpithet());
|
234
|
nonViralName2.setInfraSpecificEpithet(null);
|
235
|
assertEquals(null, nonViralName2.getInfraSpecificEpithet());
|
236
|
}
|
237
|
|
238
|
/**
|
239
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#getAuthorshipCache()}.
|
240
|
*/
|
241
|
@Test
|
242
|
public final void testGetAuthorshipCache() {
|
243
|
logger.warn("Not yet implemented"); // TODO
|
244
|
}
|
245
|
|
246
|
/**
|
247
|
* Test method for {@link eu.etaxonomy.cdm.model.name.NonViralName#setAuthorshipCache(java.lang.String)}.
|
248
|
*/
|
249
|
@Test
|
250
|
public final void testSetAuthorshipCache() {
|
251
|
logger.warn("Not yet implemented"); // TODO
|
252
|
}
|
253
|
}
|