Project

General

Profile

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

    
11
import static org.junit.Assert.assertEquals;
12
import static org.junit.Assert.assertNotEquals;
13

    
14
import org.junit.Before;
15
import org.junit.BeforeClass;
16
import org.junit.Test;
17

    
18
import eu.etaxonomy.cdm.model.common.Language;
19
import eu.etaxonomy.cdm.model.common.LanguageString;
20
import eu.etaxonomy.cdm.model.name.Rank;
21
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
22
import eu.etaxonomy.cdm.model.taxon.Taxon;
23
import eu.etaxonomy.cdm.model.term.DefaultTermInitializer;
24

    
25
/**
26
 * @author a.mueller
27
 * @since 23.04.2018
28
 *
29
 */
30
public class TaxonInteractionTest {
31

    
32

    
33
    private Taxon taxon;
34
    private TaxonInteraction taxonInteraction;
35

    
36
    /**
37
     * @throws java.lang.Exception
38
     */
39
    @BeforeClass
40
    public static void setUpBeforeClass() throws Exception {
41
        if (Language.DEFAULT() == null){
42
            DefaultTermInitializer vocabularyStore = new DefaultTermInitializer();
43
            vocabularyStore.initialize();
44
        }
45
    }
46

    
47
    /**
48
     * @throws java.lang.Exception
49
     */
50
    @Before
51
    public void setUp() throws Exception {
52

    
53
        taxon = Taxon.NewInstance(TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES(), "Abies", null, "alba", null, null, null, null, null), null);
54
        taxonInteraction = TaxonInteraction.NewInstance();
55
        taxonInteraction.setTaxon2(taxon);
56
        LanguageString langString = LanguageString.NewInstance("TestTaxonInteraction", Language.ENGLISH());
57

    
58
        taxonInteraction.putDescription(langString);
59
    }
60

    
61

    
62
    @Test
63
    public void testClone(){
64
        TaxonInteraction clone = (TaxonInteraction)taxonInteraction.clone();
65
        assertNotEquals(clone.getDescription().get(Language.ENGLISH()), taxonInteraction.getDescription().get(Language.ENGLISH()));
66
        assertEquals(clone.getDescription(Language.ENGLISH()),taxonInteraction.getDescription(Language.ENGLISH()));
67
    }
68

    
69
}
(9-9/10)