Project

General

Profile

Download (3.43 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 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.api.service;
11

    
12
import static org.junit.Assert.assertEquals;
13
import static org.junit.Assert.assertNull;
14

    
15
import java.util.UUID;
16

    
17
import org.apache.log4j.Logger;
18
import org.junit.Test;
19
import org.unitils.spring.annotation.SpringBeanByType;
20

    
21
import eu.etaxonomy.cdm.model.name.BotanicalName;
22
import eu.etaxonomy.cdm.model.taxon.Taxon;
23
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
24
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
25

    
26
/**
27
 * @author a.mueller
28
 *
29
 */
30
public class TaxonServiceImplTest extends CdmIntegrationTest {
31
	private static final Logger logger = Logger.getLogger(TaxonServiceImplTest.class);
32
	
33
	@SpringBeanByType
34
	private ITaxonService service;
35
	
36
	@SpringBeanByType
37
	private INameService nameService;
38
	
39
/****************** TESTS *****************************/
40
	
41
	/**
42
	 * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#setDao(eu.etaxonomy.cdm.persistence.dao.taxon.ITaxonDao)}.
43
	 */
44
	@Test
45
	public final void testSetDao() {
46
		logger.warn("Not implemented yet");
47
	}
48

    
49
	/**
50
	 * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#getTaxonByUuid(java.util.UUID)}.
51
	 */
52
	@Test
53
	public final void testGetTaxonByUuid() {
54
		Taxon expectedTaxon = Taxon.NewInstance(null, null);
55
		UUID uuid = service.save(expectedTaxon);
56
		TaxonBase actualTaxon = service.find(uuid);
57
		assertEquals(expectedTaxon, actualTaxon);
58
	}
59

    
60
	/**
61
	 * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#saveTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)}.
62
	 */
63
	@Test
64
	public final void testSaveTaxon() {
65
		Taxon expectedTaxon = Taxon.NewInstance(null, null);
66
		UUID uuid = service.save(expectedTaxon);
67
		TaxonBase actualTaxon = service.find(uuid);
68
		assertEquals(expectedTaxon, actualTaxon);
69
	}
70

    
71
	/**
72
	 * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#removeTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)}.
73
	 */
74
	@Test
75
	public final void testRemoveTaxon() {
76
		Taxon taxon = Taxon.NewInstance(BotanicalName.NewInstance(null), null);
77
		UUID uuid = service.save(taxon);
78
		service.delete(taxon);
79
		TaxonBase actualTaxon = service.find(uuid);
80
		assertNull(actualTaxon);
81
	}
82
	
83
	/**
84
	 * Test method for
85
	 * {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#loadTreeBranchTo(eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.model.name.Rank, java.util.List)}
86
	 * .
87
	 */
88
	@Test
89
	public final void loadTreeBranchTo() {
90
		logger.warn("Not yet implemented"); // TODO
91
	}
92

    
93
	/**
94
	 * Test method for
95
	 * {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#searchTaxaByName(java.lang.String, eu.etaxonomy.cdm.model.reference.ReferenceBase)}
96
	 * .
97
	 */
98
	@Test
99
	public final void testSearchTaxaByName() {
100
		logger.warn("Not yet implemented"); // TODO
101
	}
102

    
103
	/**
104
	 * Test method for
105
	 * {@link eu.etaxonomy.cdm.api.service.TaxonServiceImpl#getRootTaxa(eu.etaxonomy.cdm.model.reference.ReferenceBase)}
106
	 * .
107
	 */
108
	@Test
109
	public final void testGetRootTaxa() {
110
		logger.warn("Not yet implemented"); // TODO
111
	}
112
	
113
	@Test
114
	public final void testPrintDataSet() {
115
		//printDataSet(System.out);
116
	}
117
	
118
	public final void testMakeTaxonSynonym() {
119
		
120
	}
121
}
(4-4/8)