Project

General

Profile

Download (3.97 KB) Statistics
| Branch: | Tag: | Revision:
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.assertEquals;
14
import static org.junit.Assert.assertNotNull;
15
import static org.junit.Assert.assertSame;
16
import static org.junit.Assert.assertTrue;
17

    
18
import java.io.FileNotFoundException;
19
import java.util.List;
20

    
21
import org.junit.Before;
22
import org.junit.Test;
23
import org.unitils.spring.annotation.SpringBeanByType;
24

    
25
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
26
import eu.etaxonomy.cdm.model.common.TermType;
27
import eu.etaxonomy.cdm.model.common.TermVocabulary;
28
import eu.etaxonomy.cdm.model.name.Rank;
29
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
30
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
31

    
32
/**
33
 * @author a.mueller
34
 * @created Aug 07, 2014
35
 */
36
//@SpringApplicationContext("file:./target/test-classes/eu/etaxonomy/cdm/applicationContext-test.xml")
37
public class VocabularyServiceImplTest extends CdmTransactionalIntegrationTest{
38

    
39
	
40
	@SpringBeanByType
41
	private IVocabularyService vocabularyService;
42

    
43
	
44

    
45

    
46
	/**
47
	 * @throws java.lang.Exception
48
	 */
49
	@Before
50
	public void setUp() throws Exception {
51
	}
52

    
53

    
54
    /**
55
     * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getRankVocabulary()}.
56
     */
57
    @Test
58
//    @Ignore //FIXME assertSame does not work yet
59
    public void testGetRankVocabulary() {
60
        List<TermVocabulary<Rank>> rankVocabularyList = vocabularyService.findByTermType(TermType.Rank);
61
        assertTrue(rankVocabularyList.size() == 1);
62
        OrderedTermVocabulary<Rank> rankVocabulary = (OrderedTermVocabulary<Rank>)rankVocabularyList.get(0);
63
        assertNotNull(rankVocabulary);
64
        assertEquals(62, rankVocabulary.size());
65
        Rank highestRank = rankVocabulary.getHighestTerm();
66
        assertEquals(Rank.EMPIRE(), highestRank);
67
        assertEquals(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank));
68
//        assertSame(Rank.EMPIRE(), highestRank);  //as we do not use second level cache this is not required
69
//        assertSame(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank)); //as we do not use second level cache this is not required
70
    }
71

    
72
    /**
73
     * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getTypeDesignationVocabulary()}.
74
     */
75
    @Test
76
//    @Ignore  //not yet correctly implemented
77
    public void testGetTypeDesignationVocabulary() {
78
        List<TermVocabulary<SpecimenTypeDesignationStatus>> typeDesignationVocabularyList =
79
        		vocabularyService.findByTermType(TermType.SpecimenTypeDesignationStatus);
80
        assertTrue(typeDesignationVocabularyList.size() == 1);
81
        OrderedTermVocabulary<SpecimenTypeDesignationStatus> typeDesignationVocabulary = (OrderedTermVocabulary<SpecimenTypeDesignationStatus>)typeDesignationVocabularyList.get(0);
82
        
83
        assertNotNull(typeDesignationVocabulary);
84
        assertEquals(16, typeDesignationVocabulary.size());
85
        SpecimenTypeDesignationStatus highestType = typeDesignationVocabulary.getHighestTerm();
86
        assertEquals(SpecimenTypeDesignationStatus.HOLOTYPE(), highestType);
87
        assertEquals(SpecimenTypeDesignationStatus.LECTOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));
88
//      assertSame(SpecimenTypeDesignationStatus.EPITYPE(), highestType);   //as we do not use second level cache this is not required
89
//      assertSame(SpecimenTypeDesignationStatus.HOLOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));   //as we do not use second level cache this is not required
90
    }
91

    
92

    
93
    /* (non-Javadoc)
94
     * @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData()
95
     */
96
    @Override
97
    public void createTestDataSet() throws FileNotFoundException {
98
        // TODO Auto-generated method stub
99
        
100
    }
101

    
102
}
(31-31/31)