some more cache strategy tests
authorAndreas Müller <a.mueller@bgbm.org>
Tue, 13 Jul 2010 16:15:59 +0000 (16:15 +0000)
committerAndreas Müller <a.mueller@bgbm.org>
Tue, 13 Jul 2010 16:15:59 +0000 (16:15 +0000)
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/reference/ArticleDefaultCacheStrategyTest.java
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/reference/BookSectionDefaultCacheStrategyTest.java

index 287b053f85d4a2e4c30a2327fee90a069b0701c7..8b7e6f8fa4797947e8dbdbd9430cca645d590fda 100644 (file)
@@ -126,4 +126,18 @@ public class ArticleDefaultCacheStrategyTest {
                Assert.assertEquals("in My journal ser. 2, 34", defaultStrategy.getNomRefTitleWithoutYearAndAuthor((ReferenceBase)article1));\r
        }\r
        \r
+       @Test \r
+       public void testOldExistingBugs(){\r
+               journal1.setTitle("Univ. Calif. Publ. Bot.");\r
+               journal1.setAuthorTeam(null);\r
+               \r
+               Team articleAuthor = Team.NewTitledInstance("Babc. & Stebbins", "Babc. & Stebbins");\r
+               article1.setTitle("");\r
+               article1.setInJournal(journal1);\r
+               article1.setAuthorTeam(articleAuthor);\r
+               article1.setVolume("18");\r
+               article1.setDatePublished(TimePeriod.NewInstance(1943));\r
+               Assert.assertEquals("Babc. & Stebbins in Univ. Calif. Publ. Bot. 18. 1943", defaultStrategy.getTitleCache((ReferenceBase)article1));\r
+       }\r
+       \r
 }\r
index ce533516b94cd0ee154903ee0d6b00cdbfe52c9a..0f26df02257f58629213372b54d2d198a55921cc 100644 (file)
@@ -120,4 +120,26 @@ public class BookSectionDefaultCacheStrategyTest {
                Assert.assertEquals("in Book Author, My book: 55. 1975", bookSection1.getNomenclaturalCitation(detail1));\r
        }\r
        \r
+       @Test\r
+       public void testRealExample(){\r
+               Team bookTeam = Team.NewTitledInstance("Chaudhary S. A.(ed.)", "Chaudhary S. A.(ed.)");\r
+               IBook book = ReferenceFactory.newBook();\r
+               book.setTitle("Flora of the Kingdom of Saudi Arabia");\r
+               book.setAuthorTeam(bookTeam);\r
+               book.setVolume("2(3)");\r
+               book.setPlacePublished("Riyadh");\r
+               book.setPublisher("National Herbarium");\r
+               book.setDatePublished(TimePeriod.NewInstance(2000));\r
+               \r
+               Team sectionTeam = Team.NewTitledInstance("Chaudhary S. A.", "Chaudhary S. A.");\r
+               IBookSection bookSection = ReferenceFactory.newBookSection();\r
+               bookSection.setTitle("73. Hedypnois - 87. Crepis");\r
+               bookSection.setInBook(book);\r
+               bookSection.setAuthorTeam(sectionTeam);\r
+               bookSection.setPages("222-251");\r
+               System.out.println(bookSection.getTitleCache());\r
+               Assert.assertEquals("Chaudhary S. A. - 73. Hedypnois - 87. Crepis in Chaudhary S. A.(ed.), Flora of the Kingdom of Saudi Arabia 2(3). 2000", bookSection.getTitleCache());\r
+               \r
+       }\r
+       \r
 }\r