Project

General

Profile

Download (3.47 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.name.Rank;
24
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
25
import eu.etaxonomy.cdm.model.term.OrderedTermVocabulary;
26
import eu.etaxonomy.cdm.model.term.TermType;
27
import eu.etaxonomy.cdm.model.term.TermVocabulary;
28
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
29

    
30
/**
31
 * @author a.mueller
32
 * @since 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
	@Before
41
	public void setUp() throws Exception {}
42

    
43
    @Test
44
//    @Ignore //FIXME assertSame does not work yet
45
    public void testGetRankVocabulary() {
46
        List<TermVocabulary<Rank>> rankVocabularyList = vocabularyService.findByTermType(TermType.Rank, null);
47
        assertTrue(rankVocabularyList.size() == 1);
48
        OrderedTermVocabulary<Rank> rankVocabulary = (OrderedTermVocabulary<Rank>)rankVocabularyList.get(0);
49
        assertNotNull(rankVocabulary);
50
        assertEquals(62, rankVocabulary.size());
51
        Rank highestRank = rankVocabulary.getHighestTerm();
52
        assertEquals(Rank.EMPIRE(), highestRank);
53
        assertEquals(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank));
54
//        assertSame(Rank.EMPIRE(), highestRank);  //as we do not use second level cache this is not required
55
//        assertSame(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank)); //as we do not use second level cache this is not required
56
    }
57

    
58
    @Test
59
//    @Ignore  //not yet correctly implemented
60
    public void testGetTypeDesignationVocabulary() {
61
        List<TermVocabulary<SpecimenTypeDesignationStatus>> typeDesignationVocabularyList =
62
        		vocabularyService.findByTermType(TermType.SpecimenTypeDesignationStatus, null);
63
        assertTrue(typeDesignationVocabularyList.size() == 1);
64
        OrderedTermVocabulary<SpecimenTypeDesignationStatus> typeDesignationVocabulary = (OrderedTermVocabulary<SpecimenTypeDesignationStatus>)typeDesignationVocabularyList.get(0);
65

    
66
        assertNotNull(typeDesignationVocabulary);
67
        assertEquals(16, typeDesignationVocabulary.size());
68
        SpecimenTypeDesignationStatus highestType = typeDesignationVocabulary.getHighestTerm();
69
        assertEquals(SpecimenTypeDesignationStatus.HOLOTYPE(), highestType);
70
        assertEquals(SpecimenTypeDesignationStatus.LECTOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));
71
//      assertSame(SpecimenTypeDesignationStatus.EPITYPE(), highestType);   //as we do not use second level cache this is not required
72
//      assertSame(SpecimenTypeDesignationStatus.HOLOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));   //as we do not use second level cache this is not required
73
    }
74

    
75
    @Override
76
    public void createTestDataSet() throws FileNotFoundException {}
77
}
(40-40/40)