1
|
/**
|
2
|
* Copyright (C) 2009 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.strategy.cache.term;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.junit.Assert;
|
15
|
import org.junit.Before;
|
16
|
import org.junit.Test;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
19
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
20
|
import eu.etaxonomy.cdm.model.name.Rank;
|
21
|
import eu.etaxonomy.cdm.test.TermTestBase;
|
22
|
|
23
|
/**
|
24
|
* @author a.mueller
|
25
|
* @since 19.05.2010
|
26
|
*/
|
27
|
public class TermDefaultCacheStrategyTest extends TermTestBase {
|
28
|
|
29
|
@SuppressWarnings("unused")
|
30
|
private static final Logger logger = Logger.getLogger(TermDefaultCacheStrategyTest.class);
|
31
|
|
32
|
private TermDefaultCacheStrategy<?> strategy;
|
33
|
|
34
|
//************************* SET UP ****************************************
|
35
|
|
36
|
@Before
|
37
|
public void setUp() throws Exception {
|
38
|
strategy = new TermDefaultCacheStrategy<>();
|
39
|
}
|
40
|
|
41
|
//******************************* TEST **********************************************
|
42
|
|
43
|
@Test
|
44
|
public void testGetUuid() {
|
45
|
String uuid = "9cdf52c1-bac4-4b6c-a7f9-1a87401bd8f9";
|
46
|
Assert.assertEquals("UUID should be equal", uuid, strategy.getUuid().toString());
|
47
|
}
|
48
|
|
49
|
@Test
|
50
|
public void testGetTitleCache() {
|
51
|
Assert.assertEquals("Genus title cache should be 'Genus'", "Genus", Rank.GENUS().getTitleCache());
|
52
|
Assert.assertEquals("Nom. Illeg. title cache should be 'Illegitimate'", "Illegitimate", NomenclaturalStatusType.ILLEGITIMATE().getTitleCache());
|
53
|
}
|
54
|
|
55
|
@Test
|
56
|
public void testGetTitleCacheNoRepresentations() {
|
57
|
final String newTermUuid = "e3a6e29d-314a-4e06-be70-cbfe093842ec";
|
58
|
NamedArea newTerm = NamedArea.NewInstance();
|
59
|
newTerm.setUuid(UUID.fromString(newTermUuid));
|
60
|
|
61
|
Assert.assertEquals("Term with no representation must return a title that makes some sense", "NamedArea<e3a6e29d-314a-4e06-be70-cbfe093842ec>", newTerm.getTitleCache());
|
62
|
}
|
63
|
}
|