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
|
package eu.etaxonomy.cdm.model.term;
|
10
|
|
11
|
import static org.junit.Assert.assertNotNull;
|
12
|
import static org.junit.Assert.assertNull;
|
13
|
|
14
|
import java.util.Set;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
import org.junit.Assert;
|
18
|
import org.junit.BeforeClass;
|
19
|
import org.junit.Test;
|
20
|
|
21
|
import eu.etaxonomy.cdm.model.common.Language;
|
22
|
import eu.etaxonomy.cdm.model.description.Feature;
|
23
|
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
|
24
|
import eu.etaxonomy.cdm.model.term.init.TermLoader;
|
25
|
|
26
|
/**
|
27
|
* @author a.mueller
|
28
|
* @since 02.03.2009
|
29
|
*/
|
30
|
public class DefaultTermInitializerTest {
|
31
|
|
32
|
@SuppressWarnings("unused")
|
33
|
private static final Logger logger = Logger.getLogger(DefaultTermInitializerTest.class);
|
34
|
|
35
|
@BeforeClass
|
36
|
public static void setUpBeforeClass() {
|
37
|
TermLoader termLoader = new TermLoader();
|
38
|
termLoader.unloadAllTerms();
|
39
|
}
|
40
|
|
41
|
@Test
|
42
|
public void testInitialize(){
|
43
|
assertNull("At the beginning of the initialization test the default language should still be null but is not", Language.DEFAULT());
|
44
|
DefaultTermInitializer initalizer = new DefaultTermInitializer();
|
45
|
initalizer.initialize();
|
46
|
assertNotNull("Default language should be english but is null", Language.DEFAULT());
|
47
|
TermVocabulary<Language> voc = Language.DEFAULT().getVocabulary();
|
48
|
assertNotNull("language for language vocabulary representation was null but must be default language", voc.getRepresentation(Language.DEFAULT()));
|
49
|
|
50
|
Set<MeasurementUnit> units = Feature.ALTITUDE().getRecommendedMeasurementUnits();
|
51
|
Assert.assertEquals("Recommended measurement unit should exist", 1, units.size());
|
52
|
Assert.assertEquals(MeasurementUnit.uuidMeter, units.iterator().next().getUuid());
|
53
|
}
|
54
|
}
|