Project

General

Profile

« Previous | Next » 

Revision 4dbcb616

Added by Andreas Müller over 3 years ago

cleanup and use TermTestBase for model tests

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/HomotypicalGroupTest.java
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
9

  
10 9
package eu.etaxonomy.cdm.model.name;
11 10

  
12

  
13 11
import java.util.Set;
14 12

  
15 13
import org.apache.log4j.Logger;
16
import org.junit.After;
17
import org.junit.AfterClass;
18 14
import org.junit.Assert;
19 15
import org.junit.Before;
20
import org.junit.BeforeClass;
21 16
import org.junit.Test;
22 17

  
23
import eu.etaxonomy.cdm.model.term.DefaultTermInitializer;
24

  
18
import eu.etaxonomy.cdm.test.unit.EntityTestBase;
25 19

  
26 20
/**
27 21
 * @author a.mueller
28 22
 * @since 18.06.2009
29
 * @version 1.0
30 23
 */
31
public class HomotypicalGroupTest {
32
	private static final Logger logger = Logger.getLogger(HomotypicalGroupTest.class);
24
public class HomotypicalGroupTest extends EntityTestBase {
25

  
26
	@SuppressWarnings("unused")
27
    private static final Logger logger = Logger.getLogger(HomotypicalGroupTest.class);
33 28

  
34 29
	private static HomotypicalGroup group1;
35 30
	private static HomotypicalGroup group2;
......
38 33
	private static TaxonName name3;
39 34
	private static TaxonName name4;
40 35

  
41

  
42
	/**
43
	 * @throws java.lang.Exception
44
	 */
45
	@BeforeClass
46
	public static void setUpBeforeClass() throws Exception {
47
		new DefaultTermInitializer().initialize();
48
	}
49

  
50
	/**
51
	 * @throws java.lang.Exception
52
	 */
53
	@AfterClass
54
	public static void tearDownAfterClass() throws Exception {
55
	}
56

  
57
	/**
58
	 * @throws java.lang.Exception
59
	 */
60 36
	@Before
61 37
	public void setUp() throws Exception {
62 38
		name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
......
65 41
		name4 = TaxonNameFactory.NewBotanicalInstance(Rank.VARIETY());
66 42
	}
67 43

  
68
	/**
69
	 * @throws java.lang.Exception
70
	 */
71
	@After
72
	public void tearDown() throws Exception {
73
	}
74

  
75 44
//*********************** TESTS ***********************************************/
76 45

  
77 46
	@Test
......
88 57
		basionyms =  name2.getHomotypicalGroup().getBasionyms();
89 58
		Assert.assertEquals("Number of basionyms should be 2", 2, basionyms.size());
90 59
//		Assert.assertEquals("", name2, basionyms.iterator().next());
91

  
92 60
	}
93 61

  
94 62
	@Test
......
106 74
		name4.addReplacedSynonym(name2, null, null, null, null);
107 75
		Set<NameRelationship> rels = name2.getHomotypicalGroup().getBasionymAndReplacedSynonymRelations();
108 76
		Assert.assertEquals("Number of relations should be 3", 3, rels.size());
109

  
110 77
	}
111 78

  
112 79
	@Test
......
151 118
		Assert.assertEquals(name1, name4.getBasionym());
152 119
		Assert.assertEquals(1, hg.getBasionyms().size());
153 120

  
154
		hg.removeGroupBasionym(name1);
121
		HomotypicalGroup.removeGroupBasionym(name1);
155 122
		Assert.assertEquals(0, hg.getBasionyms().size());
156 123

  
157 124
		Assert.assertEquals(0, name2.getBasionyms().size());
......
160 127
		Assert.assertEquals(null, name4.getBasionym());
161 128

  
162 129
	}
163
	/*
164
	@Test
165
	public void testClone(){
166
		group1 = HomotypicalGroup.NewInstance();
167

  
168
		group1.addTypifiedName(name1);
169
		group1.addTypifiedName(name2);
170
		group1.setGroupBasionym(name1);
171
		HomotypicalGroup clone =(HomotypicalGroup)group1.clone();
172

  
173
		Assert.assertEquals(clone.getTypifiedNames().size(), group1.getTypifiedNames().size());
174
		TaxonName cloneBasionym = clone.getBasionyms().iterator().next();
175
		TaxonName group1Basionym = group1.getBasionyms().iterator().next();
176
		Assert.assertNotSame(cloneBasionym, group1Basionym);
177
	}
178
	*/
179

  
180

  
181 130

  
182
}
131
// TODO clone not yet implemented in HomotypicalGroup
132
//	@Test
133
//	public void testClone(){
134
//		group1 = HomotypicalGroup.NewInstance();
135
//
136
//		group1.addTypifiedName(name1);
137
//		group1.addTypifiedName(name2);
138
//		group1.setGroupBasionym(name1);
139
//		HomotypicalGroup clone =(HomotypicalGroup)group1.clone();
140
//
141
//		Assert.assertEquals(clone.getTypifiedNames().size(), group1.getTypifiedNames().size());
142
//		TaxonName cloneBasionym = clone.getBasionyms().iterator().next();
143
//		TaxonName group1Basionym = group1.getBasionyms().iterator().next();
144
//		Assert.assertNotSame(cloneBasionym, group1Basionym);
145
//	}
146
}

Also available in: Unified diff