Project

General

Profile

Download (3.75 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.assertTrue;
16

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

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

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

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

    
38
	@SpringBeanByType
39
	private IVocabularyService vocabularyService;
40

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

    
47

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

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

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

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

    
89
}
(31-31/31)