Project

General

Profile

« Previous | Next » 

Revision 660bc0a7

Added by Niels Hoffmann over 13 years ago

Two tests for taxon business logic that should work. Set to ignore because they are failing at the moment. Please include once this is fixed.

View differences:

cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonServiceImplBusinessTest.java
10 10

  
11 11
package eu.etaxonomy.cdm.api.service;
12 12

  
13
import java.util.List;
13 14
import java.util.Set;
14 15

  
15 16
import junit.framework.Assert;
16 17

  
17 18
import org.junit.Before;
19
import org.junit.Ignore;
18 20
import org.junit.Test;
19 21

  
22
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
20 23
import eu.etaxonomy.cdm.model.name.NonViralName;
21 24
import eu.etaxonomy.cdm.model.reference.Reference;
22 25
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
......
45 48
	private NonViralName s1n;
46 49
	private NonViralName t2n;
47 50
	private NonViralName t1n;
51
	private NonViralName s2n;
48 52

  
49 53
	/**
50 54
	 * @throws java.lang.Exception
......
62 66
		s1n = NonViralName.NewInstance(null);
63 67
		s1 = Synonym.NewInstance(s1n, reference);
64 68
		
69
		s2n = NonViralName.NewInstance(null);
70
		
65 71
		// referencing
66 72
		synonymRelationshipType = SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF();
67 73
		reference = ReferenceFactory.newGeneric();
......
83 89
	 * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#changeSynonymToAcceptedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon)}.
84 90
	 */
85 91
	@Test
92
	@Ignore
86 93
	public final void testChangeSynonymToAcceptedTaxon() {
87 94
		t1.addSynonym(s1, synonymRelationshipType);
88 95
		Taxon taxon = service.changeSynonymToAcceptedTaxon(s1, t1);
......
90 97
		Assert.assertTrue("Former accepted taxon should not have synonyms anymore", t1.getSynonyms().isEmpty());
91 98
		Assert.assertNotNull(taxon);
92 99
		Assert.assertEquals(s1n, taxon.getName());
100
		HomotypicalGroup newGroup = taxon.getName().getHomotypicalGroup();
101
		Assert.assertTrue("Homotypical group of new accepted taxon should contain exactly one name", newGroup.getTypifiedNames().size() == 1);
102
	}
103
	
104
	/**
105
	 * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#changeSynonymToAcceptedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon)}.
106
	 */
107
	@Test
108
	@Ignore
109
	public final void testChangeSynonymWithMultipleSynonymsInHomotypicalGroupToAcceptedTaxon() {
110
		t1.addSynonym(s1, synonymRelationshipType);
111
				
112
		HomotypicalGroup group = s1.getHomotypicGroup();
113
		group.addTypifiedName(s2n);
114
		t1.addHeterotypicSynonymName(s2n);
115
		
116
		Taxon taxon = service.changeSynonymToAcceptedTaxon(s1, t1);
117
		
118
		Assert.assertTrue("Former accepted taxon should not have synonyms anymore", t1.getSynonyms().isEmpty());
119
		Assert.assertNotNull(taxon);
120
		Assert.assertEquals(s1n, taxon.getName());
121
		Assert.assertTrue("New accepted taxon should have a synonym", ! taxon.getSynonyms().isEmpty());
122
		
123
		List<Synonym> synonymsInNewTaxonsGroup = taxon.getHomotypicGroup().getSynonymsInGroup(taxon.getSec());
124
		Assert.assertTrue("New accepted taxons homotypic group should have a synonym", synonymsInNewTaxonsGroup.size() == 1);
93 125
	}
94 126

  
95 127
	/**

Also available in: Unified diff