1
|
/**
|
2
|
* Copyright (C) 2017 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.name;
|
10
|
|
11
|
import static org.junit.Assert.assertNotNull;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.junit.Assert;
|
15
|
import org.junit.Before;
|
16
|
import org.junit.BeforeClass;
|
17
|
import org.junit.Test;
|
18
|
|
19
|
import eu.etaxonomy.cdm.model.name.Rank;
|
20
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
21
|
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
|
22
|
import eu.etaxonomy.cdm.model.term.DefaultTermInitializer;
|
23
|
|
24
|
/**
|
25
|
* @author a.mueller
|
26
|
* @since 18.09.2017
|
27
|
*
|
28
|
*/
|
29
|
public class ViralNameDefaultCacheStrategyTest {
|
30
|
@SuppressWarnings("unused")
|
31
|
private static final Logger logger = Logger.getLogger(ViralNameDefaultCacheStrategyTest.class);
|
32
|
|
33
|
private TaxonNameDefaultCacheStrategy strategy;
|
34
|
private TaxonName viralName;
|
35
|
|
36
|
|
37
|
@BeforeClass
|
38
|
public static void setUpBeforeClass() {
|
39
|
DefaultTermInitializer vocabularyStore = new DefaultTermInitializer();
|
40
|
vocabularyStore.initialize();
|
41
|
}
|
42
|
|
43
|
@Before
|
44
|
public void setUp() throws Exception {
|
45
|
strategy = TaxonNameDefaultCacheStrategy.NewInstance();
|
46
|
viralName = TaxonNameFactory.NewViralInstance(Rank.SPECIES()); //TODO do viral names have ranks? See comment on #IViralName
|
47
|
}
|
48
|
|
49
|
|
50
|
/********* TEST *******************************************/
|
51
|
|
52
|
/**
|
53
|
* Test method for {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy#NewInstance()}.
|
54
|
*/
|
55
|
@Test
|
56
|
public final void testNewInstance() {
|
57
|
assertNotNull(strategy);
|
58
|
}
|
59
|
|
60
|
@Test
|
61
|
public final void testTitle() {
|
62
|
Assert.assertEquals("", strategy.getTitleCache(viralName));
|
63
|
|
64
|
viralName.setTitleCache("My virus", true);
|
65
|
Assert.assertEquals("My virus", strategy.getTitleCache(viralName));
|
66
|
|
67
|
}
|
68
|
|
69
|
|
70
|
}
|