Project

General

Profile

Download (3.75 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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.assertNotNull;
14
import static org.junit.Assert.assertTrue;
15

    
16
import java.io.FileNotFoundException;
17
import java.util.List;
18

    
19
import org.junit.Before;
20
import org.junit.Test;
21
import org.unitils.spring.annotation.SpringBeanByType;
22

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

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

    
37
	@SpringBeanByType
38
	private IVocabularyService vocabularyService;
39

    
40
	/**
41
	 * @throws java.lang.Exception
42
	 */
43
	@Before
44
	public void setUp() throws Exception {}
45

    
46

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

    
65
    /**
66
     * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getTypeDesignationVocabulary()}.
67
     */
68
    @Test
69
//    @Ignore  //not yet correctly implemented
70
    public void testGetTypeDesignationVocabulary() {
71
        List<TermVocabulary<SpecimenTypeDesignationStatus>> typeDesignationVocabularyList =
72
        		vocabularyService.findByTermType(TermType.SpecimenTypeDesignationStatus, null);
73
        assertTrue(typeDesignationVocabularyList.size() == 1);
74
        OrderedTermVocabulary<SpecimenTypeDesignationStatus> typeDesignationVocabulary = (OrderedTermVocabulary<SpecimenTypeDesignationStatus>)typeDesignationVocabularyList.get(0);
75

    
76
        assertNotNull(typeDesignationVocabulary);
77
        assertEquals(16, typeDesignationVocabulary.size());
78
        SpecimenTypeDesignationStatus highestType = typeDesignationVocabulary.getHighestTerm();
79
        assertEquals(SpecimenTypeDesignationStatus.HOLOTYPE(), highestType);
80
        assertEquals(SpecimenTypeDesignationStatus.LECTOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));
81
//      assertSame(SpecimenTypeDesignationStatus.EPITYPE(), highestType);   //as we do not use second level cache this is not required
82
//      assertSame(SpecimenTypeDesignationStatus.HOLOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));   //as we do not use second level cache this is not required
83
    }
84

    
85
    @Override
86
    public void createTestDataSet() throws FileNotFoundException {}
87

    
88
}
(34-34/34)