Project

General

Profile

Download (2.02 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.BotanicalName;
19
import eu.etaxonomy.cdm.model.name.Rank;
20
import eu.etaxonomy.cdm.model.reference.Reference;
21
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
22
import eu.etaxonomy.cdm.model.taxon.Taxon;
23

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

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

    
37
	
38
//*********************** TESTS ****************************************************/
39
	
40
	@Test
41
	public void testGetTitleCache(){
42
		
43
		BotanicalName botName = BotanicalName.NewInstance(Rank.SPECIES());
44
		botName.setGenusOrUninomial("Genus");
45
		botName.setSpecificEpithet("species");
46
		
47
		Reference sec = ReferenceFactory.newGeneric();
48
		sec.setTitleCache("My sec", true);
49
		Taxon taxon = Taxon.NewInstance(botName, sec);
50
		TaxonDescription taxonDescription = TaxonDescription.NewInstance(taxon);
51
		Assert.assertEquals("Wrong title cache for description", "Taxon description for Genus species", taxonDescription.getTitleCache());
52
		taxonDescription.setImageGallery(true);
53
		Assert.assertEquals("Wrong title cache for description", "Image gallery for Genus species", taxonDescription.getTitleCache());
54
		taxonDescription = TaxonDescription.NewInstance();
55
		Assert.assertEquals("Wrong title cache for description", "Taxon description", taxonDescription.getTitleCache());
56
		taxonDescription.setImageGallery(true);
57
		Assert.assertEquals("Wrong title cache for description", "Image gallery", taxonDescription.getTitleCache());
58

    
59
	}
60
	
61
}
    (1-1/1)