Project

General

Profile

Download (2.09 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.ReferenceBase;
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
		ReferenceFactory refFactory = ReferenceFactory.newInstance();
43
		
44
		BotanicalName botName = BotanicalName.NewInstance(Rank.SPECIES());
45
		botName.setGenusOrUninomial("Genus");
46
		botName.setSpecificEpithet("species");
47
		
48
		ReferenceBase sec = refFactory.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", "Taxon description for Genus species", taxonDescription.getTitleCache());
53
		taxonDescription.setImageGallery(true);
54
		Assert.assertEquals("Wrong title cache for description", "Image galery for Genus species", taxonDescription.getTitleCache());
55
		taxonDescription = TaxonDescription.NewInstance();
56
		Assert.assertEquals("Wrong title cache for description", "Taxon description", taxonDescription.getTitleCache());
57
		taxonDescription.setImageGallery(true);
58
		Assert.assertEquals("Wrong title cache for description", "Image galery", taxonDescription.getTitleCache());
59

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