3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.cdm
.api
.service
;
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
;
18 import java
.util
.List
;
20 import org
.junit
.Before
;
21 import org
.junit
.Test
;
22 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
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
;
33 * @created Aug 07, 2014
35 //@SpringApplicationContext("file:./target/test-classes/eu/etaxonomy/cdm/applicationContext-test.xml")
36 public class VocabularyServiceImplTest
extends CdmTransactionalIntegrationTest
{
40 private IVocabularyService vocabularyService
;
46 * @throws java.lang.Exception
49 public void setUp() throws Exception
{
54 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getRankVocabulary()}.
57 // @Ignore //FIXME assertSame does not work yet
58 public void testGetRankVocabulary() {
59 List
<TermVocabulary
<Rank
>> rankVocabularyList
= vocabularyService
.findByTermType(TermType
.Rank
);
60 assertTrue(rankVocabularyList
.size() == 1);
61 OrderedTermVocabulary
<Rank
> rankVocabulary
= (OrderedTermVocabulary
<Rank
>)rankVocabularyList
.get(0);
62 assertNotNull(rankVocabulary
);
63 assertEquals(62, rankVocabulary
.size());
64 Rank highestRank
= rankVocabulary
.getHighestTerm();
65 assertEquals(Rank
.EMPIRE(), highestRank
);
66 assertEquals(Rank
.DOMAIN(), rankVocabulary
.getNextLowerTerm(highestRank
));
67 // assertSame(Rank.EMPIRE(), highestRank); //as we do not use second level cache this is not required
68 // assertSame(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank)); //as we do not use second level cache this is not required
72 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getTypeDesignationVocabulary()}.
75 // @Ignore //not yet correctly implemented
76 public void testGetTypeDesignationVocabulary() {
77 List
<TermVocabulary
<SpecimenTypeDesignationStatus
>> typeDesignationVocabularyList
=
78 vocabularyService
.findByTermType(TermType
.SpecimenTypeDesignationStatus
);
79 assertTrue(typeDesignationVocabularyList
.size() == 1);
80 OrderedTermVocabulary
<SpecimenTypeDesignationStatus
> typeDesignationVocabulary
= (OrderedTermVocabulary
<SpecimenTypeDesignationStatus
>)typeDesignationVocabularyList
.get(0);
82 assertNotNull(typeDesignationVocabulary
);
83 assertEquals(16, typeDesignationVocabulary
.size());
84 SpecimenTypeDesignationStatus highestType
= typeDesignationVocabulary
.getHighestTerm();
85 assertEquals(SpecimenTypeDesignationStatus
.HOLOTYPE(), highestType
);
86 assertEquals(SpecimenTypeDesignationStatus
.LECTOTYPE(), typeDesignationVocabulary
.getNextLowerTerm(highestType
));
87 // assertSame(SpecimenTypeDesignationStatus.EPITYPE(), highestType); //as we do not use second level cache this is not required
88 // assertSame(SpecimenTypeDesignationStatus.HOLOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType)); //as we do not use second level cache this is not required