2 package eu
.etaxonomy
.cdm
.strategy
.cache
.reference
;
4 import static org
.junit
.Assert
.*;
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
;
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
;
18 public class CdDvdDefaultCacheStrategyTest
{
19 @SuppressWarnings("unused")
20 private static Logger logger
= Logger
.getLogger(CdDvdDefaultCacheStrategyTest
.class);
26 TimePeriod publicationDate
;
27 CdDvdDefaultCacheStrategy
<CdDvd
> instance
;
30 public static void setUpBeforeClass() throws Exception
{
34 public static void tearDownAfterClass() throws Exception
{
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();
51 public void tearDown() throws Exception
{
55 public void testNewInstance() {
56 assertNotNull(instance
);
60 public void testGetNomRefTitleWithoutYearAndAuthor() {
61 String result
= instance
.getNomRefTitleWithoutYearAndAuthor(cdDvd
);
62 assertEquals(title
, result
);
65 //TODO missing publicationPlace and publisher has to be discussed
67 public void testGetTitleCache() {
68 String result
= instance
.getTitleCache(cdDvd
);
69 assertEquals(title
+ ". 1999-2001", result
);