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 java.math.BigDecimal;
|
15
|
|
16
|
import org.junit.Before;
|
17
|
import org.junit.Test;
|
18
|
|
19
|
import eu.etaxonomy.cdm.test.unit.EntityTestBase;
|
20
|
|
21
|
/**
|
22
|
* @author a.mueller
|
23
|
* @since 23.04.2018
|
24
|
*/
|
25
|
public class QuantitativeDataTest extends EntityTestBase {
|
26
|
|
27
|
private QuantitativeData quantData;
|
28
|
|
29
|
@Before
|
30
|
public void setUp() throws Exception {
|
31
|
quantData = QuantitativeData.NewInstance();
|
32
|
|
33
|
StatisticalMeasurementValue statisticalValue = StatisticalMeasurementValue.NewInstance();
|
34
|
statisticalValue.setType(StatisticalMeasure.AVERAGE() );
|
35
|
statisticalValue.setValue(new BigDecimal("23.8"));
|
36
|
quantData.addStatisticalValue(statisticalValue);
|
37
|
}
|
38
|
|
39
|
@Test
|
40
|
public void testClone(){
|
41
|
QuantitativeData clone = quantData.clone();
|
42
|
BigDecimal cloneValue = clone.getStatisticalValues().iterator().next().getValue();
|
43
|
BigDecimal origValue = quantData.getStatisticalValues().iterator().next().getValue();
|
44
|
assertTrue(origValue == cloneValue);
|
45
|
assertNotSame(clone.getStatisticalValues().iterator().next(), quantData.getStatisticalValues().iterator().next());
|
46
|
}
|
47
|
}
|