1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.cdm.api.service;
|
12
|
|
13
|
import static org.junit.Assert.assertFalse;
|
14
|
import static org.junit.Assert.assertNull;
|
15
|
import static org.junit.Assert.assertTrue;
|
16
|
|
17
|
import java.io.FileNotFoundException;
|
18
|
import java.util.HashSet;
|
19
|
import java.util.List;
|
20
|
import java.util.UUID;
|
21
|
|
22
|
import org.junit.Assert;
|
23
|
import org.junit.Before;
|
24
|
import org.junit.Test;
|
25
|
import org.unitils.spring.annotation.SpringBeanByType;
|
26
|
|
27
|
import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;
|
28
|
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
|
29
|
import eu.etaxonomy.cdm.model.name.NonViralName;
|
30
|
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
31
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
32
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
33
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
34
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
|
35
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
|
36
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
37
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
38
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
39
|
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
|
40
|
|
41
|
/**
|
42
|
* This test checks of all the business logic methods do what they are expected to do.
|
43
|
*
|
44
|
* @author n.hoffmann
|
45
|
* @created Dec 16, 2010
|
46
|
* @version 1.0
|
47
|
*/
|
48
|
public class TaxonServiceImplBusinessTest extends CdmIntegrationTest {
|
49
|
|
50
|
private Synonym s1;
|
51
|
private Synonym s2;
|
52
|
private Taxon t2;
|
53
|
private Taxon t1;
|
54
|
@SpringBeanByType
|
55
|
private ITaxonService service;
|
56
|
|
57
|
@SpringBeanByType
|
58
|
private INameService nameService;
|
59
|
private String referenceDetail;
|
60
|
private Reference<?> reference;
|
61
|
private SynonymRelationshipType homoTypicSynonymRelationshipType;
|
62
|
private SynonymRelationshipType heteroTypicSynonymRelationshipType;
|
63
|
private NonViralName<?> s1n;
|
64
|
private NonViralName<?> t2n;
|
65
|
private NonViralName<?> t1n;
|
66
|
private NonViralName<?> s2n;
|
67
|
|
68
|
/**
|
69
|
* @throws java.lang.Exception
|
70
|
*/
|
71
|
@Before
|
72
|
public void setUp() throws Exception {
|
73
|
//service = new TaxonServiceImpl();
|
74
|
//nameService = new NameServiceImpl();
|
75
|
|
76
|
t1n = NonViralName.NewInstance(null);
|
77
|
t1 = Taxon.NewInstance(t1n, reference);
|
78
|
|
79
|
t2n = NonViralName.NewInstance(null);
|
80
|
t2 = Taxon.NewInstance(t2n, reference);
|
81
|
|
82
|
s1n = NonViralName.NewInstance(null);
|
83
|
s1 = Synonym.NewInstance(s1n, reference);
|
84
|
|
85
|
s2n = NonViralName.NewInstance(null);
|
86
|
s2 = Synonym.NewInstance(s2n, reference);
|
87
|
|
88
|
// referencing
|
89
|
homoTypicSynonymRelationshipType = SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF();
|
90
|
heteroTypicSynonymRelationshipType = SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF();
|
91
|
reference = ReferenceFactory.newGeneric();
|
92
|
referenceDetail = "test";
|
93
|
}
|
94
|
|
95
|
|
96
|
/**
|
97
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#swapSynonymAndAcceptedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon)}.
|
98
|
*/
|
99
|
@Test
|
100
|
public final void testSwapSynonymAndAcceptedTaxon() {
|
101
|
t1.addSynonym(s1, homoTypicSynonymRelationshipType);
|
102
|
|
103
|
service.swapSynonymAndAcceptedTaxon(s1, t1);
|
104
|
}
|
105
|
|
106
|
/**
|
107
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#changeSynonymToAcceptedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon)}.
|
108
|
*/
|
109
|
@Test
|
110
|
public final void testChangeSynonymToAcceptedTaxon() {
|
111
|
|
112
|
t1.addSynonym(s1, homoTypicSynonymRelationshipType);
|
113
|
HomotypicalGroup oldGroup = s1.getName().getHomotypicalGroup();
|
114
|
Assert.assertEquals("Homotypical group of new accepted taxon should contain exactly 2 names", 2, oldGroup.getTypifiedNames().size());
|
115
|
boolean deleteSynonym = false;
|
116
|
boolean copyCitationInfo = true;
|
117
|
Taxon taxon = null;
|
118
|
try {
|
119
|
taxon = service.changeSynonymToAcceptedTaxon(s1, t1, deleteSynonym, copyCitationInfo, null, null);
|
120
|
Assert.fail("Change must fail for synonym and taxon in same homotypical group");
|
121
|
} catch (HomotypicalGroupChangeException e) {
|
122
|
//OK
|
123
|
}
|
124
|
t1.addSynonym(s2, heteroTypicSynonymRelationshipType);
|
125
|
Assert.assertEquals("Homotypical group of old accepted taxon should still contain exactly 2 names", 2, oldGroup.getTypifiedNames().size());
|
126
|
Assert.assertTrue("Old accepted taxon should now have 2 synonyms", t1.getSynonyms().size() == 2);
|
127
|
try {
|
128
|
taxon = service.changeSynonymToAcceptedTaxon(s2, t1, deleteSynonym, copyCitationInfo, null, null);
|
129
|
} catch (HomotypicalGroupChangeException e) {
|
130
|
Assert.fail("Change must not throw exception for heterotypic synonym change");
|
131
|
}
|
132
|
|
133
|
Assert.assertTrue("Former accepted taxon should still have 1 synonym", t1.getSynonyms().size() == 1);
|
134
|
Assert.assertNotNull(taxon);
|
135
|
Assert.assertEquals(s2n, taxon.getName());
|
136
|
HomotypicalGroup newGroup = taxon.getName().getHomotypicalGroup();
|
137
|
Assert.assertEquals("Homotypical group of new accepted taxon should contain exactly one name", 1, newGroup.getTypifiedNames().size());
|
138
|
}
|
139
|
|
140
|
/**
|
141
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#changeSynonymToAcceptedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon)}.
|
142
|
*/
|
143
|
@Test
|
144
|
public final void testChangeSynonymWithMultipleSynonymsInHomotypicalGroupToAcceptedTaxon() {
|
145
|
t1.addSynonym(s1, heteroTypicSynonymRelationshipType);
|
146
|
TaxonNameBase<?,?> otherHeteroSynonymName = NonViralName.NewInstance(null);
|
147
|
t1.addHeterotypicSynonymName(otherHeteroSynonymName);
|
148
|
TaxonNameBase<?,?> homotypicSynonymName = NonViralName.NewInstance(null);
|
149
|
Synonym homotypicSynonym = Synonym.NewInstance(homotypicSynonymName, t1.getSec());
|
150
|
t1.addHomotypicSynonym(homotypicSynonym, null, null);
|
151
|
|
152
|
HomotypicalGroup group = s1.getHomotypicGroup();
|
153
|
Reference<?> citation1 = ReferenceFactory.newBook();
|
154
|
String microReference1 = "p. 55";
|
155
|
SynonymRelationship s2rel = t1.addHeterotypicSynonymName(s2n, group, citation1, microReference1);
|
156
|
Synonym s2 = s2rel.getSynonym();
|
157
|
HomotypicalGroup homoGroup2 = s1.getHomotypicGroup();
|
158
|
Assert.assertEquals("Homotypical group must be the same group as for the old synonym", group, homoGroup2);
|
159
|
|
160
|
//run
|
161
|
Taxon newTaxon = null;
|
162
|
try {
|
163
|
newTaxon = service.changeSynonymToAcceptedTaxon(s1, t1, false, true, null, null);
|
164
|
} catch (HomotypicalGroupChangeException e1) {
|
165
|
Assert.fail("Invocation of change method should not throw an exception");
|
166
|
}
|
167
|
|
168
|
Assert.assertEquals("Former accepted taxon should now have 2 synonyms left", 2, t1.getSynonyms().size());
|
169
|
Assert.assertEquals("Former accepted taxon should now have 1 heterotypic synonym group left", 1, t1.getHeterotypicSynonymyGroups().size());
|
170
|
Assert.assertNotNull(newTaxon);
|
171
|
Assert.assertEquals(s1n, newTaxon.getName());
|
172
|
Assert.assertEquals("New accepted taxon should have 1 synonym", 1, newTaxon.getSynonyms().size());
|
173
|
Assert.assertEquals("The new synonym must be the homotypic synonym of the old synonym", s2, newTaxon.getSynonyms().iterator().next());
|
174
|
HomotypicalGroup homoGroup = newTaxon.getHomotypicGroup();
|
175
|
Assert.assertEquals("Homotypical group must be the same group as for the old synonym", group, homoGroup);
|
176
|
|
177
|
List<Synonym> synonymsInNewTaxonsGroup = newTaxon.getSynonymsInGroup(homoGroup);
|
178
|
String message = "New accepted taxon should have 1 synonym in its homotypic group: s2. The old synonym may still exist (or not) but not as a synonym of the new taxon";
|
179
|
Assert.assertEquals(message, 1, synonymsInNewTaxonsGroup.size());
|
180
|
Assert.assertTrue("The old synonym's homotypic 'partner' must be a synonym of the new accepted taxon, too.", synonymsInNewTaxonsGroup.contains(s2));
|
181
|
Assert.assertTrue("The old synonym must be in the new accepted taxons homotypic group as it has not been deleted ", newTaxon.getName().getHomotypicalGroup().equals(s2.getName().getHomotypicalGroup()));
|
182
|
|
183
|
boolean iWasHere = false;
|
184
|
for (Synonym syn : synonymsInNewTaxonsGroup){
|
185
|
if (syn.equals(s2) ){
|
186
|
SynonymRelationship rel = s2.getSynonymRelations().iterator().next();
|
187
|
Assert.assertEquals("s2 relationship needs to have the same citation as the former relation to the given accepted taxon.", citation1, rel.getCitation());
|
188
|
iWasHere = true;
|
189
|
}
|
190
|
}
|
191
|
Assert.assertTrue("Relationship to s2 must have been concidered in 'for'-loop", iWasHere);
|
192
|
|
193
|
try {
|
194
|
service.changeSynonymToAcceptedTaxon(homotypicSynonym, t1, false, true, null, null);
|
195
|
Assert.fail("The method should throw an exception when invoked on taxa in the same homotypical group");
|
196
|
} catch (HomotypicalGroupChangeException e) {
|
197
|
//OK
|
198
|
}
|
199
|
|
200
|
// Assert.assertNull("Synonym should not be used in a name anymore", s1.getName());
|
201
|
|
202
|
|
203
|
}
|
204
|
|
205
|
/**
|
206
|
* Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#changeSynonymToRelatedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String)}.
|
207
|
*/
|
208
|
@Test
|
209
|
public final void testChangeSynonymToRelatedTaxon() {
|
210
|
t1.addSynonym(s1, homoTypicSynonymRelationshipType);
|
211
|
t1.addSynonym(s2, homoTypicSynonymRelationshipType);
|
212
|
HashSet newInstances = new HashSet<TaxonBase>();
|
213
|
newInstances.add(s1);
|
214
|
newInstances.add(t1);
|
215
|
newInstances.add(t2);
|
216
|
service.save(newInstances);
|
217
|
TaxonNameBase synonymName = s1.getName();
|
218
|
UUID synNameUUID = synonymName.getUuid();
|
219
|
|
220
|
Taxon newTaxon = service.changeSynonymToRelatedTaxon(s1, t2, TaxonRelationshipType.CONGRUENT_OR_EXCLUDES(), reference, referenceDetail);
|
221
|
//check removeTaxonBase()
|
222
|
//UUID s1UUID = service.update(s1);
|
223
|
UUID newTaxonUUID = service.save(newTaxon).getUuid();
|
224
|
|
225
|
|
226
|
s1 =(Synonym)service.find(s1.getUuid());
|
227
|
newTaxon = (Taxon)service.find(newTaxonUUID);
|
228
|
assertNull(s1);
|
229
|
synonymName = nameService.find(synNameUUID);
|
230
|
assertFalse(synonymName.getTaxonBases().contains(s1));
|
231
|
assertTrue(synonymName.getTaxonBases().contains(newTaxon));
|
232
|
|
233
|
synonymName = s2.getName();
|
234
|
newTaxon = service.changeSynonymToRelatedTaxon(s2, t1, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), reference, referenceDetail);
|
235
|
//check removeTaxonBase()
|
236
|
//UUID s1UUID = service.update(s1);
|
237
|
newTaxonUUID = service.save(newTaxon).getUuid();
|
238
|
|
239
|
|
240
|
s2 =(Synonym)service.find(s2.getUuid());
|
241
|
newTaxon = (Taxon)service.find(newTaxonUUID);
|
242
|
assertNull(s2);
|
243
|
|
244
|
assertFalse(synonymName.getTaxonBases().contains(s2));
|
245
|
assertTrue(synonymName.getTaxonBases().contains(newTaxon));
|
246
|
|
247
|
|
248
|
}
|
249
|
//
|
250
|
// Moved to TaxonServiceImplTest
|
251
|
// /**
|
252
|
// * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#moveSynonymToAnotherTaxon(eu.etaxonomy.cdm.model.taxon.SynonymRelationship, eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String)}.
|
253
|
// */
|
254
|
// @Test
|
255
|
// public final void testMoveSynonymToAnotherTaxon() {
|
256
|
// t1.addSynonym(s1, homoTypicSynonymRelationshipType);
|
257
|
//
|
258
|
// SynonymRelationship synonymRelation = t1.getSynonymRelations().iterator().next();
|
259
|
//
|
260
|
// boolean keepReference = false;
|
261
|
// boolean moveHomotypicGroup = false;
|
262
|
// try {
|
263
|
// service.moveSynonymToAnotherTaxon(synonymRelation, t2, moveHomotypicGroup, homoTypicSynonymRelationshipType, reference, referenceDetail, keepReference);
|
264
|
// } catch (HomotypicalGroupChangeException e) {
|
265
|
// // TODO Auto-generated catch block
|
266
|
// e.printStackTrace();
|
267
|
// }
|
268
|
//
|
269
|
// Assert.assertTrue("t1 should have no synonym relationships", t1.getSynonymRelations().isEmpty());
|
270
|
//
|
271
|
// Set<SynonymRelationship> synonymRelations = t2.getSynonymRelations();
|
272
|
// Assert.assertTrue("t2 should have exactly one synonym relationship", synonymRelations.size() == 1);
|
273
|
//
|
274
|
// synonymRelation = synonymRelations.iterator().next();
|
275
|
//
|
276
|
// Assert.assertEquals(t2, synonymRelation.getAcceptedTaxon());
|
277
|
// Assert.assertEquals(homoTypicSynonymRelationshipType, synonymRelation.getType());
|
278
|
// Assert.assertEquals(reference, synonymRelation.getCitation());
|
279
|
// Assert.assertEquals(referenceDetail, synonymRelation.getCitationMicroReference());
|
280
|
// }
|
281
|
|
282
|
@Test
|
283
|
public void changeHomotypicalGroupOfSynonym(){
|
284
|
|
285
|
//s1 - Heterotypic
|
286
|
t1.addSynonym(s1, heteroTypicSynonymRelationshipType);
|
287
|
|
288
|
//s2 - heterotypic
|
289
|
TaxonNameBase otherHeteroSynonymName = NonViralName.NewInstance(null);
|
290
|
Synonym s2 = Synonym.NewInstance(otherHeteroSynonymName, t1.getSec());
|
291
|
t1.addSynonym(s2, heteroTypicSynonymRelationshipType, null, null);
|
292
|
TaxonNameBase<?,?> otherHeteroSynonymNameB = NonViralName.NewInstance(null);
|
293
|
otherHeteroSynonymName.addBasionym(otherHeteroSynonymNameB);
|
294
|
Synonym s2b = Synonym.NewInstance(otherHeteroSynonymNameB, t1.getSec());
|
295
|
t1.addSynonym(s2b, heteroTypicSynonymRelationshipType, null, null);
|
296
|
|
297
|
//homotypic
|
298
|
TaxonNameBase homotypicSynonymName = NonViralName.NewInstance(null);
|
299
|
Synonym homotypicSynonym = Synonym.NewInstance(homotypicSynonymName, t1.getSec());
|
300
|
t1.addHomotypicSynonym(homotypicSynonym, null, null);
|
301
|
t1.getName().addBasionym(homotypicSynonymName);
|
302
|
|
303
|
//Preconditions test
|
304
|
Assert.assertFalse("s2 must not be in s1 homotypic group", s2.getHomotypicGroup().equals(s1.getHomotypicGroup()));
|
305
|
Assert.assertFalse("s2 must not be in t1 homotypic group", s2.getHomotypicGroup().equals(t1.getHomotypicGroup()));
|
306
|
Assert.assertEquals("s2 must have exactly 1 synonym relationship", 1, s2.getSynonymRelations().size());
|
307
|
Assert.assertEquals("s2 must have heterotypic relationship", heteroTypicSynonymRelationshipType, s2.getSynonymRelations().iterator().next().getType());
|
308
|
Assert.assertEquals("s2 must have exactly 1 basionym relationships", 1, s2.getName().getBasionyms().size());
|
309
|
|
310
|
//do it
|
311
|
service.changeHomotypicalGroupOfSynonym(s2, s1.getHomotypicGroup(), t1, false, true);
|
312
|
|
313
|
//postconditions
|
314
|
Assert.assertEquals("s2 must be in s1 homotypic group", s2.getHomotypicGroup(), s1.getHomotypicGroup());
|
315
|
Assert.assertEquals("s2 must have exactly 1 synonym relationship", 1, s2.getSynonymRelations().size());
|
316
|
Assert.assertEquals("s2 must have heterotypic relationship", heteroTypicSynonymRelationshipType, s2.getSynonymRelations().iterator().next().getType());
|
317
|
Assert.assertEquals("s2 must have exactly 0 basionym relationships", 0, s2.getName().getBasionyms().size());
|
318
|
|
319
|
|
320
|
//Preconditions test
|
321
|
Assert.assertEquals("'homotypicSynonym' must have exactly 1 basionym relationships", 1, homotypicSynonym.getName().getNameRelations().size());
|
322
|
Assert.assertEquals("'t1' must have exactly 1 basionym relationships", 1, t1.getName().getBasionyms().size());
|
323
|
Assert.assertFalse("s2 must not be in t1 homotypic group", s2.getHomotypicGroup().equals(t1.getHomotypicGroup()));
|
324
|
|
325
|
|
326
|
//do it
|
327
|
service.changeHomotypicalGroupOfSynonym(s2, homotypicSynonym.getHomotypicGroup(), null, false, true);
|
328
|
|
329
|
//postconditions
|
330
|
Assert.assertEquals("s2 must be in 'homotypicSynonym' homotypic group", s2.getHomotypicGroup(), homotypicSynonym.getHomotypicGroup());
|
331
|
Assert.assertEquals("s2 must be in 't1' homotypic group", s2.getHomotypicGroup(), t1.getHomotypicGroup());
|
332
|
Assert.assertEquals("s2 must have exactly 1 synonym relationship", 1, s2.getSynonymRelations().size());
|
333
|
Assert.assertEquals("s2 must have homotypic relationship", this.homoTypicSynonymRelationshipType, s2.getSynonymRelations().iterator().next().getType());
|
334
|
Assert.assertEquals("s2 must have exactly 1 basionym relationships", 1, s2.getName().getBasionyms().size());
|
335
|
Assert.assertEquals("'homotypicSynonym' must have exactly 2 basionym relationships", 2, homotypicSynonym.getName().getNameRelations().size());
|
336
|
Assert.assertEquals("'t1' must have exactly 1 basionym relationships", 1, t1.getName().getBasionyms().size());
|
337
|
Assert.assertEquals("'t1' must have exactly 2 homotypic synonyms", 2, t1.getHomotypicSynonymsByHomotypicRelationship().size());
|
338
|
Assert.assertEquals("'t1' must have exactly 2 names in homotypic group", 2, t1.getHomotypicSynonymsByHomotypicGroup().size());
|
339
|
Assert.assertEquals("'t1' homotypic group must include 3 names (t1, s2, homotypicSynonym)", 3, t1.getHomotypicGroup().getTypifiedNames().size());
|
340
|
|
341
|
|
342
|
//do it
|
343
|
service.changeHomotypicalGroupOfSynonym(s2, t2.getHomotypicGroup(), t2, true, false);
|
344
|
|
345
|
//postconditions
|
346
|
Assert.assertEquals("s2 must be in 't2' homotypic group", t2.getHomotypicGroup(), s2.getHomotypicGroup());
|
347
|
Assert.assertFalse("s2 must not be in 't1' homotypic group", s2.getHomotypicGroup().equals(t1.getHomotypicGroup()));
|
348
|
Assert.assertEquals("s2 must have exactly 1 synonym relationship", 1, s2.getSynonymRelations().size());
|
349
|
Assert.assertEquals("s2 must have homotypic relationship", this.homoTypicSynonymRelationshipType, s2.getSynonymRelations().iterator().next().getType());
|
350
|
Assert.assertEquals("s2 must have exactly 0 basionym relationships", 0, s2.getName().getBasionyms().size());
|
351
|
Assert.assertEquals("'homotypicSynonym' must have exactly 1 basionym relationships", 1, homotypicSynonym.getName().getNameRelations().size());
|
352
|
Assert.assertEquals("'t1' must have exactly 1 basionym relationships", 1, t1.getName().getBasionyms().size());
|
353
|
Assert.assertEquals("'t1' must have exactly 1 homotypic synonyms", 1, t1.getHomotypicSynonymsByHomotypicRelationship().size());
|
354
|
Assert.assertEquals("'t1' must have exactly 1 names in homotypic group", 1, t1.getHomotypicSynonymsByHomotypicGroup().size());
|
355
|
Assert.assertEquals("'t1' homotypic group must include 2 names (t1, homotypicSynonym)", 2, t1.getHomotypicGroup().getTypifiedNames().size());
|
356
|
|
357
|
//do it
|
358
|
service.changeHomotypicalGroupOfSynonym(s2, s1.getHomotypicGroup(), t1, false, false);
|
359
|
|
360
|
//postconditions
|
361
|
Assert.assertEquals("s2 must be in s1 homotypic group", s2.getHomotypicGroup(), s1.getHomotypicGroup());
|
362
|
Assert.assertFalse("s2 must not be in 't2' homotypic group", t2.getHomotypicGroup().equals(s2.getHomotypicGroup()));
|
363
|
Assert.assertEquals("s2 must have exactly 2 synonym relationships", 2, s2.getSynonymRelations().size());
|
364
|
for (SynonymRelationship rel: s2.getSynonymRelations()){
|
365
|
Assert.assertEquals("Both relationships of s2 must be heterotypic", heteroTypicSynonymRelationshipType, rel.getType());
|
366
|
}
|
367
|
Assert.assertEquals("s2 must have exactly 0 basionym relationships", 0, s2.getName().getBasionyms().size());
|
368
|
|
369
|
}
|
370
|
|
371
|
|
372
|
/* (non-Javadoc)
|
373
|
* @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData()
|
374
|
*/
|
375
|
@Override
|
376
|
public void createTestDataSet() throws FileNotFoundException {
|
377
|
// TODO Auto-generated method stub
|
378
|
|
379
|
}
|
380
|
|
381
|
}
|