Project

General

Profile

Download (2.01 KB) Statistics
| Branch: | Tag: | Revision:
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

    
10
package eu.etaxonomy.cdm.strategy.cache.description;
11

    
12

    
13
import org.junit.Assert;
14
import org.junit.Before;
15
import org.junit.Test;
16

    
17
import eu.etaxonomy.cdm.model.description.TaxonDescription;
18
import eu.etaxonomy.cdm.model.name.IBotanicalName;
19
import eu.etaxonomy.cdm.model.name.Rank;
20
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
21
import eu.etaxonomy.cdm.model.reference.Reference;
22
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
23
import eu.etaxonomy.cdm.model.taxon.Taxon;
24

    
25
/**
26
 * @author a.mueller
27
 *
28
 */
29
public class TaxonDescriptionDefaultCacheStrategyTest {
30

    
31
	/**
32
	 * @throws java.lang.Exception
33
	 */
34
	@Before
35
	public void setUp() throws Exception {
36
	}
37

    
38

    
39
//*********************** TESTS ****************************************************/
40

    
41
	@Test
42
	public void testGetTitleCache(){
43

    
44
		IBotanicalName botName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
45
		botName.setGenusOrUninomial("Genus");
46
		botName.setSpecificEpithet("species");
47

    
48
		Reference sec = ReferenceFactory.newGeneric();
49
		sec.setTitleCache("My sec", true);
50
		Taxon taxon = Taxon.NewInstance(botName, sec);
51
		TaxonDescription taxonDescription = TaxonDescription.NewInstance(taxon);
52
		Assert.assertEquals("Wrong title cache for description", "Factual data for Genus species", taxonDescription.getTitleCache());
53
		taxonDescription.setImageGallery(true);
54
		Assert.assertEquals("Wrong title cache for description", "Image gallery for Genus species", taxonDescription.getTitleCache());
55
		taxonDescription = TaxonDescription.NewInstance();
56
		Assert.assertEquals("Wrong title cache for description", "Factual data", taxonDescription.getTitleCache());
57
		taxonDescription.setImageGallery(true);
58
		Assert.assertEquals("Wrong title cache for description", "Image gallery", taxonDescription.getTitleCache());
59

    
60
	}
61

    
62
}
    (1-1/1)