Project

General

Profile

Download (2.2 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2019 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.taxon;
10

    
11
import org.junit.Assert;
12
import org.junit.Before;
13
import org.junit.BeforeClass;
14
import org.junit.Test;
15

    
16
import eu.etaxonomy.cdm.common.UTF8;
17
import eu.etaxonomy.cdm.model.common.Language;
18
import eu.etaxonomy.cdm.model.term.DefaultTermInitializer;
19

    
20
/**
21
 * @author a.mueller
22
 * @since 26.02.2019
23
 *
24
 */
25
public class TaxonRelationshipTypeTest {
26

    
27
    @BeforeClass
28
    public static void setUpBeforeClass() throws Exception {
29
        if (Language.ENGLISH() == null){
30
            new DefaultTermInitializer().initialize();
31
        }
32
    }
33

    
34
    @Before
35
    public void setUp() throws Exception {
36
    }
37

    
38
    @Test
39
    public void testRepresentations() {
40
        //these tests mostly test that UTF8 symbols have not bee manipulated in the csv files by encoding changes.
41
        //They are not meant for defining correct symbols over long time. Many of the symbols are not finally discussed.
42

    
43
        //MISAPPLIED_NAME_FOR
44
        TaxonRelationshipType type = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
45
        Assert.assertEquals(UTF8.EM_DASH.toString(), inverseAbbrev(type));
46
        Assert.assertEquals(UTF8.EM_DASH_DOUBLE.toString(), abbrev(type));
47

    
48
        //PRO PARTE MISAPPLIED_NAME_FOR
49
        type = TaxonRelationshipType.PRO_PARTE_MISAPPLIED_NAME_FOR();
50
        Assert.assertEquals(UTF8.EM_DASH + "(p.p.)", inverseAbbrev(type));
51
        Assert.assertEquals(UTF8.EM_DASH_DOUBLE + "(p.p.)", abbrev(type));
52

    
53
        type = TaxonRelationshipType.PARTIAL_MISAPPLIED_NAME_FOR();
54
        Assert.assertEquals(UTF8.EM_DASH + "(part.)", inverseAbbrev(type));
55
        Assert.assertEquals(UTF8.EM_DASH_DOUBLE + "(part.)", abbrev(type));
56

    
57
    }
58

    
59
    private String inverseAbbrev(TaxonRelationshipType relType) {
60
        return relType.getPreferredInverseRepresentation(null).getAbbreviatedLabel();
61
    }
62

    
63
    private String abbrev(TaxonRelationshipType relType) {
64
        return relType.getPreferredRepresentation((Language)null).getAbbreviatedLabel();
65
    }
66

    
67
}
(7-7/8)