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.assertNotSame;
|
12
|
import static org.junit.Assert.assertTrue;
|
13
|
|
14
|
import org.junit.Before;
|
15
|
import org.junit.BeforeClass;
|
16
|
import org.junit.Test;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer;
|
19
|
import eu.etaxonomy.cdm.model.common.Language;
|
20
|
|
21
|
/**
|
22
|
* @author a.mueller
|
23
|
* @since 23.04.2018
|
24
|
*
|
25
|
*/
|
26
|
public class QuantitativeDataTest {
|
27
|
|
28
|
private QuantitativeData quantData;
|
29
|
|
30
|
@BeforeClass
|
31
|
public static void setUpBeforeClass() {
|
32
|
if (Language.DEFAULT() == null){
|
33
|
DefaultTermInitializer vocabularyStore = new DefaultTermInitializer();
|
34
|
vocabularyStore.initialize();
|
35
|
}
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* @throws java.lang.Exception
|
40
|
*/
|
41
|
@Before
|
42
|
public void setUp() throws Exception {
|
43
|
quantData = QuantitativeData.NewInstance();
|
44
|
|
45
|
StatisticalMeasurementValue statisticalValue = StatisticalMeasurementValue.NewInstance();
|
46
|
statisticalValue.setType(StatisticalMeasure.AVERAGE() );
|
47
|
statisticalValue.setValue((float) 23.8);
|
48
|
quantData.addStatisticalValue(statisticalValue);
|
49
|
|
50
|
}
|
51
|
|
52
|
|
53
|
@Test
|
54
|
public void testClone(){
|
55
|
QuantitativeData clone = (QuantitativeData) quantData.clone();
|
56
|
float cloneValue = clone.getStatisticalValues().iterator().next().getValue();
|
57
|
float origValue = quantData.getStatisticalValues().iterator().next().getValue();
|
58
|
assertTrue(origValue == cloneValue);
|
59
|
assertNotSame(clone.getStatisticalValues().iterator().next(), quantData.getStatisticalValues().iterator().next());
|
60
|
|
61
|
}
|
62
|
|
63
|
}
|