PublicationBase tests
[cdmlib.git] / cdmlib-model / src / test / java / eu / etaxonomy / cdm / strategy / cache / reference / CdDvdDefaultCacheStrategyTest.java
1
2 package eu.etaxonomy.cdm.strategy.cache.reference;
3
4 import static org.junit.Assert.*;
5
6 import org.apache.log4j.Logger;
7 import org.hibernate.search.store.DirectoryProviderHelper;
8 import org.junit.After;
9 import org.junit.AfterClass;
10 import org.junit.Before;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13
14 import eu.etaxonomy.cdm.model.common.TimePeriod;
15 import eu.etaxonomy.cdm.model.reference.CdDvd;
16 import eu.etaxonomy.cdm.strategy.cache.reference.CdDvdDefaultCacheStrategy;
17
18 public class CdDvdDefaultCacheStrategyTest {
19 @SuppressWarnings("unused")
20 private static Logger logger = Logger.getLogger(CdDvdDefaultCacheStrategyTest.class);
21
22 CdDvd cdDvd;
23 String title;
24 String publisher;
25 String place;
26 TimePeriod publicationDate;
27 CdDvdDefaultCacheStrategy<CdDvd> instance;
28
29 @BeforeClass
30 public static void setUpBeforeClass() throws Exception {
31 }
32
33 @AfterClass
34 public static void tearDownAfterClass() throws Exception {
35 }
36
37 @Before
38 public void setUp() throws Exception {
39 this.cdDvd = CdDvd.NewInstance();
40 title = "A nice CD title";
41 cdDvd.setTitle(title);
42 publisher = "An ugly publisher";
43 place = "A beutiful place";
44 //cdDvd.addPublisher(publisher, place);
45 publicationDate = TimePeriod.NewInstance(1999, 2001);
46 cdDvd.setDatePublished(publicationDate);
47 this.instance = CdDvdDefaultCacheStrategy.NewInstance();
48 }
49
50 @After
51 public void tearDown() throws Exception {
52 }
53
54 @Test
55 public void testNewInstance() {
56 assertNotNull(instance);
57 }
58
59 @Test
60 public void testGetNomRefTitleWithoutYearAndAuthor() {
61 String result = instance.getNomRefTitleWithoutYearAndAuthor(cdDvd);
62 assertEquals(title, result);
63 }
64
65 //TODO missing publicationPlace and publisher has to be discussed
66 @Test
67 public void testGetTitleCache() {
68 String result = instance.getTitleCache(cdDvd);
69 assertEquals(title + ". 1999-2001", result);
70 }
71
72
73 }