Revision dd9ab0c7
Added by Andreas Müller almost 3 years ago
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/reference/ReferenceDefaultCacheStrategyTest.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.model.reference.IArticle; |
27 | 27 |
import eu.etaxonomy.cdm.model.reference.IBook; |
28 | 28 |
import eu.etaxonomy.cdm.model.reference.IBookSection; |
29 |
import eu.etaxonomy.cdm.model.reference.ICdDvd; |
|
30 |
import eu.etaxonomy.cdm.model.reference.IDatabase; |
|
31 | 29 |
import eu.etaxonomy.cdm.model.reference.IGeneric; |
32 | 30 |
import eu.etaxonomy.cdm.model.reference.IJournal; |
33 | 31 |
import eu.etaxonomy.cdm.model.reference.IWebPage; |
34 | 32 |
import eu.etaxonomy.cdm.model.reference.Reference; |
35 | 33 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
36 |
import eu.etaxonomy.cdm.strategy.cache.agent.TeamDefaultCacheStrategy; |
|
37 | 34 |
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser; |
38 | 35 |
|
39 | 36 |
/** |
... | ... | |
199 | 196 |
Assert.assertEquals("Team1, My article. "+UTF8.EN_DASH+" " + ReferenceDefaultCacheStrategy.UNDEFINED_JOURNAL + ". 1975", article1.getTitleCache()); |
200 | 197 |
} |
201 | 198 |
|
202 |
@Test |
|
203 |
public void testArticleGetNomenclaturalCitation(){ |
|
204 |
journal1.setTitle("My journal"); |
|
205 |
journal1.setTitle("M. J."); |
|
206 |
((Reference)journal1).setAuthorship(articleTeam2); |
|
207 |
article1.setTitle("My article"); |
|
208 |
article1.setInJournal(journal1); |
|
209 |
article1.setAuthorship(articleTeam1); |
|
210 |
article1.setDatePublished(VerbatimTimePeriod.NewVerbatimInstance(1975)); |
|
211 |
Assert.assertEquals("in M. J.: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
212 |
|
|
213 |
article1.setVolume("22"); |
|
214 |
Assert.assertEquals("in M. J. 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
215 |
article1.setSeriesPart("ser. 11"); |
|
216 |
Assert.assertEquals("in M. J., ser. 11, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
217 |
|
|
218 |
article1.setPages("33"); //#6496 don't show pages in nomencl. citation |
|
219 |
Assert.assertEquals("in M. J., ser. 11, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
220 |
} |
|
221 |
|
|
222 |
/** |
|
223 |
* After ser. , sect. , abt. we want to have a comma, if there is not yet one following anyway |
|
224 |
*/ |
|
225 |
@Test |
|
226 |
public void testArticleGetNomenclaturalCitationSerSectAbt(){ |
|
227 |
article1.setInJournal(journal1); |
|
228 |
article1.setVolume("22"); |
|
229 |
journal1.setAbbrevTitle("J. Pl. Eur."); |
|
230 |
((Reference)journal1).setAuthorship(articleTeam2); |
|
231 |
article1.setDatePublished(VerbatimTimePeriod.NewVerbatimInstance(1975)); |
|
232 |
//no ser, sect, abt |
|
233 |
Assert.assertEquals("in J. Pl. Eur. 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
234 |
//ser |
|
235 |
journal1.setAbbrevTitle("J. Pl. Eur., ser. 3"); |
|
236 |
Assert.assertEquals("in J. Pl. Eur., ser. 3, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
237 |
journal1.setAbbrevTitle("J. Pl. Eur., Ser. 3"); |
|
238 |
Assert.assertEquals("in J. Pl. Eur., Ser. 3, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
239 |
journal1.setAbbrevTitle("J. Pl. Eur., ser. 3, s.n."); |
|
240 |
Assert.assertEquals("in J. Pl. Eur., ser. 3, s.n. 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
241 |
//sect |
|
242 |
journal1.setAbbrevTitle("J. Pl. Eur., sect. 3"); |
|
243 |
Assert.assertEquals("in J. Pl. Eur., sect. 3, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
244 |
journal1.setAbbrevTitle("J. Pl. Eur., Sect. 3"); |
|
245 |
Assert.assertEquals("in J. Pl. Eur., Sect. 3, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
246 |
journal1.setAbbrevTitle("J. Pl. Eur., Sect. 3, something"); |
|
247 |
Assert.assertEquals("in J. Pl. Eur., Sect. 3, something 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
248 |
//abt |
|
249 |
journal1.setAbbrevTitle("J. Pl. Eur., abt. 3"); |
|
250 |
Assert.assertEquals("in J. Pl. Eur., abt. 3, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
251 |
journal1.setAbbrevTitle("J. Pl. Eur., Abt. 3"); |
|
252 |
Assert.assertEquals("in J. Pl. Eur., Abt. 3, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
253 |
journal1.setAbbrevTitle("J. Pl. Eur., abt. 3, no comma"); |
|
254 |
Assert.assertEquals("in J. Pl. Eur., abt. 3, no comma 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
255 |
|
|
256 |
journal1.setAbbrevTitle("J. Pl. Eur., sect. 3"); |
|
257 |
article1.setSeriesPart("1"); |
|
258 |
Assert.assertEquals("in J. Pl. Eur., sect. 3, ser. 1, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
259 |
article1.setSeriesPart("Series 2"); |
|
260 |
Assert.assertEquals("in J. Pl. Eur., sect. 3, Series 2, 22: 55. 1975", article1.getNomenclaturalCitation(detail1)); |
|
261 |
} |
|
262 |
|
|
263 | 199 |
@Test |
264 | 200 |
public void testArticleGetTitleWithoutYearAndAuthor(){ |
265 | 201 |
journal1.setTitle("My journal"); |
... | ... | |
313 | 249 |
|
314 | 250 |
} |
315 | 251 |
|
316 |
//https://dev.e-taxonomy.eu/redmine/issues/8881 |
|
317 |
@Test |
|
318 |
public void testInRefAuthor(){ |
|
319 |
Person person1 = Person.NewInstance("Inauth.", "Inauthor", "A.B.", "Ala Bala"); |
|
320 |
Person person2 = Person.NewInstance("Twoauth.", "Twoauthor", "C.", "Cla"); |
|
321 |
Person person3 = Person.NewTitledInstance("Threeauth."); |
|
322 |
Team team = Team.NewInstance(person1, person2, person3); |
|
323 |
IBook book1 = ReferenceFactory.newBook(); |
|
324 |
book1.setAbbrevTitle("Acta Inst. Bot. Acad. Sci. URSS"); |
|
325 |
book1.setVolume("Fasc. 11"); |
|
326 |
book1.setDatePublished(TimePeriodParser.parseStringVerbatim("1955")); |
|
327 |
bookSection1.setTitle("My chapter"); |
|
328 |
bookSection1.setInBook(book1); |
|
329 |
book1.setDatePublished(VerbatimTimePeriod.NewVerbatimInstance(1956)); |
|
330 |
|
|
331 |
book1.setAuthorship(person1); |
|
332 |
Assert.assertEquals("Unexpected nomencl. reference", "in Inauthor, Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1956", bookSection1.getNomenclaturalCitation("248")); |
|
333 |
book1.setAuthorship(team); |
|
334 |
Assert.assertEquals("Unexpected nomencl. reference", "in Inauthor, Twoauthor & Threeauth., Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1956", bookSection1.getNomenclaturalCitation("248")); |
|
335 |
team.setHasMoreMembers(true); |
|
336 |
Assert.assertEquals("Unexpected nomencl. reference", "in Inauthor, Twoauthor, Threeauth. & al., Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1956", bookSection1.getNomenclaturalCitation("248")); |
|
337 |
book1.setAuthorship(Team.NewInstance(person1)); |
|
338 |
Assert.assertEquals("Unexpected nomencl. reference", "in Inauthor, Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1956", bookSection1.getNomenclaturalCitation("248")); |
|
339 |
|
|
340 |
//for the following the behavior is not yet finally discussed, may change in future |
|
341 |
book1.setAuthorship(team); |
|
342 |
team.setTitleCache("Teamcache", true); |
|
343 |
Assert.assertEquals("Unexpected nomencl. reference", "in Teamcache, Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1956", bookSection1.getNomenclaturalCitation("248")); |
|
344 |
team.setTitleCache("Teamc.", true); |
|
345 |
Assert.assertEquals("Unexpected nomencl. reference", "in Teamc., Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1956", bookSection1.getNomenclaturalCitation("248")); |
|
346 |
book1.setAuthorship(Team.NewInstance()); |
|
347 |
Assert.assertEquals("Unexpected nomencl. reference", "in "+TeamDefaultCacheStrategy.EMPTY_TEAM+", Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1956", bookSection1.getNomenclaturalCitation("248")); |
|
348 |
} |
|
349 |
|
|
350 | 252 |
@Test |
351 | 253 |
public void testBookGetTitleCache1(){ |
352 |
//series |
|
353 |
IBook book1 = ReferenceFactory.newBook(); |
|
354 |
book1.setAbbrevTitle("Acta Inst. Bot. Acad. Sci. URSS"); |
|
355 |
book1.setSeriesPart("1"); |
|
356 |
book1.setVolume("Fasc. 11"); |
|
357 |
book1.setDatePublished(TimePeriodParser.parseStringVerbatim("1955")); |
|
358 |
Assert.assertEquals("Unexpected abbrev title cache", "Acta Inst. Bot. Acad. Sci. URSS, ser. 1, Fasc. 11. 1955", book1.getTitleCache()); |
|
359 |
Assert.assertEquals("Unexpected nomencl. reference", "Acta Inst. Bot. Acad. Sci. URSS, ser. 1, Fasc. 11: 248. 1955", book1.getNomenclaturalCitation("248")); |
|
360 |
} |
|
361 |
|
|
362 |
@Test |
|
363 |
public void testBookGetTitleCache2(){ |
|
364 | 254 |
//series |
365 | 255 |
IBook book1 = ReferenceFactory.newBook(); |
366 | 256 |
book1.setAbbrevTitle("Acta Inst. Bot. Acad. Sci. URSS"); |
367 | 257 |
book1.setVolume("Fasc. 11"); |
368 | 258 |
book1.setDatePublished(TimePeriodParser.parseStringVerbatim("1955")); |
369 | 259 |
Assert.assertEquals("Unexpected abbrev title cache", "Acta Inst. Bot. Acad. Sci. URSS Fasc. 11. 1955", book1.getTitleCache()); |
370 |
Assert.assertEquals("Unexpected nomencl. reference", "Acta Inst. Bot. Acad. Sci. URSS Fasc. 11: 248. 1955", book1.getNomenclaturalCitation("248")); |
|
371 | 260 |
book1.setSeriesPart("1"); |
372 |
Assert.assertEquals("Unexpected nomencl. reference", "Acta Inst. Bot. Acad. Sci. URSS, ser. 1, Fasc. 11: 248. 1955", book1.getNomenclaturalCitation("248")); |
|
373 |
} |
|
374 |
|
|
375 |
@Test |
|
376 |
public void testBookGetNomenclaturalCitation(){ |
|
377 |
book1.setTitle("My book"); |
|
378 |
book1.setAuthorship(bookTeam1); |
|
379 |
book1.setDatePublished(VerbatimTimePeriod.NewVerbatimInstance(1975)); |
|
380 |
Assert.assertEquals("My book: 55. 1975", book1.getNomenclaturalCitation(detail1)); |
|
381 |
book1.setAbbrevTitle("Analect. Bot."); |
|
382 |
Assert.assertEquals("Analect. Bot. 1975", book1.getNomenclaturalCitation(null)); |
|
261 |
Assert.assertEquals("Unexpected abbrev title cache", "Acta Inst. Bot. Acad. Sci. URSS, ser. 1, Fasc. 11. 1955", book1.getTitleCache()); |
|
383 | 262 |
} |
384 | 263 |
|
385 | 264 |
// ***************************** Book Section ************************/ |
... | ... | |
437 | 316 |
Assert.assertEquals("Unexpected title cache.", "Section Author - My chapter. "+UTF8.EN_DASH+" In: - undefined book -. 1976", bookSection1.getTitleCache()); |
438 | 317 |
} |
439 | 318 |
|
440 |
@Test |
|
441 |
public void testBookSectionGetNomenclaturalCitation(){ |
|
442 |
book1.setTitle("My book"); |
|
443 |
book1.setAuthorship(bookTeam1); |
|
444 |
bookSection1.setTitle("My chapter"); |
|
445 |
bookSection1.setInBook(book1); |
|
446 |
bookSection1.setAuthorship(sectionTeam1); |
|
447 |
book1.setDatePublished(VerbatimTimePeriod.NewVerbatimInstance(1975)); |
|
448 |
//TODO still unclear which is correct |
|
449 |
// Assert.assertEquals("in Book Author, My book: 55. 1975", bookSection1.getNomenclaturalCitation(detail1)); |
|
450 |
Assert.assertEquals("in TT., My book: 55. 1975", bookSection1.getNomenclaturalCitation(detail1)); |
|
451 |
|
|
452 |
book1.setSeriesPart("2"); |
|
453 |
Assert.assertEquals("in TT., My book, ser. 2: 55. 1975", bookSection1.getNomenclaturalCitation(detail1)); |
|
454 |
//#6496 don't show pages in nom.ref. citations |
|
455 |
bookSection1.setPages("35-39"); |
|
456 |
Assert.assertEquals("in TT., My book, ser. 2: 55. 1975", bookSection1.getNomenclaturalCitation(detail1)); |
|
457 |
|
|
458 |
} |
|
459 |
|
|
460 | 319 |
@Test |
461 | 320 |
public void testBookSectionRealExample(){ |
462 | 321 |
Team bookTeam = Team.NewTitledInstance("Chaudhary S. A.(ed.)", "Chaudhary S. A.(ed.)"); |
... | ... | |
499 | 358 |
Assert.assertEquals("Unexpected title cache.", "auct.", generic1.getTitleCache()); |
500 | 359 |
} |
501 | 360 |
|
502 |
@Test |
|
503 |
public void testGenericGetInRef(){ |
|
504 |
generic1.setTitle("auct."); |
|
505 |
IBook book1 = ReferenceFactory.newBook(); |
|
506 |
book1.setTitle("My book title"); |
|
507 |
book1.setAuthorship(genericTeam1); |
|
508 |
Reference inRef = (Reference)book1; |
|
509 |
generic1.setInReference(inRef); |
|
510 |
generic1.setTitleCache(null, false); //reset cache in case aspectJ is not enabled |
|
511 |
//TODO author still unclear |
|
512 |
// Assert.assertEquals("Unexpected title cache.", "in Authorteam, My book title: 2", generic1.getNomenclaturalCitation("2")); |
|
513 |
Assert.assertEquals("Unexpected title cache.", "in AT., My book title: 2", generic1.getNomenclaturalCitation("2")); |
|
514 |
} |
|
515 |
|
|
516 |
@Test |
|
517 |
public void testGenericGetInRefWithoutInRef(){ |
|
518 |
generic1.setTitle("My generic title"); |
|
519 |
generic1.setAuthorship(genericTeam1); |
|
520 |
generic1.setTitleCache(null, false); //reset cache in case aspectJ is not enabled |
|
521 |
Assert.assertEquals("Unexpected title cache.", "My generic title: 2", generic1.getNomenclaturalCitation("2")); |
|
522 |
} |
|
523 |
|
|
524 | 361 |
@Test |
525 | 362 |
public void testGenericGetTitleCache2(){ |
526 | 363 |
generic1.setTitle("Part Title"); |
... | ... | |
549 | 386 |
generic1.setAbbrevTitleCache(null, false); //reset cache in case aspectJ is not enabled |
550 | 387 |
Assert.assertEquals("Unexpected abbrev title cache.", "Pt. Tit. "+UTF8.EN_DASH+" In: AT., My bk. tit. 1987", generic1.getAbbrevTitleCache()); |
551 | 388 |
Assert.assertEquals("Title cache must still be the same", "Part Title. "+UTF8.EN_DASH+" In: Authorteam, My book title. 1987", generic1.getTitleCache()); |
552 |
//TODO author still unclear |
|
553 |
// Assert.assertEquals("Unexpected nom. ref.", "in Authorteam, My bk. tit.: pp. 44. 1987", generic1.getNomenclaturalCitation("pp. 44")); |
|
554 |
Assert.assertEquals("Unexpected nom. ref.", "in AT., My bk. tit.: pp. 44. 1987", generic1.getNomenclaturalCitation("pp. 44")); |
|
555 |
generic1.setVolume("23"); |
|
556 |
Assert.assertEquals("Unexpected nom. ref.", "in AT., My bk. tit. 23: pp. 44. 1987", generic1.getNomenclaturalCitation("pp. 44")); |
|
557 |
generic1.setSeriesPart("ser. 11"); |
|
558 |
//TODO |
|
559 |
// Assert.assertEquals("Unexpected nom. ref.", "in AT., My bk. tit., ser. 11, 23: pp. 44. 1987", generic1.getNomenclaturalCitation("pp. 44")); |
|
560 | 389 |
|
561 | 390 |
//protected |
562 | 391 |
generic1.setAbbrevTitleCache("My prot. abb. tit. in a bk.", true); |
563 | 392 |
Assert.assertEquals("Unexpected abbrev title cache.", "My prot. abb. tit. in a bk.", generic1.getAbbrevTitleCache()); |
564 | 393 |
Assert.assertEquals("Unexpected title cache.", "Part Title. "+UTF8.EN_DASH+" In: Authorteam, My book title. 1987", generic1.getTitleCache()); |
565 |
|
|
566 |
generic1.setDatePublished((VerbatimTimePeriod)null); |
|
567 |
Assert.assertEquals("Unexpected nom. ref.", "My prot. abb. tit. in a bk.", generic1.getNomenclaturalCitation(null)); |
|
568 |
Assert.assertEquals("Unexpected nom. ref.", "My prot. abb. tit. in a bk.", generic1.getNomenclaturalCitation("")); |
|
569 |
Assert.assertEquals("Unexpected nom. ref.", "My prot. abb. tit. in a bk.: pp. 44", generic1.getNomenclaturalCitation("pp. 44")); |
|
570 |
|
|
571 |
generic1.setDatePublished(TimePeriodParser.parseStringVerbatim("1893")); |
|
572 |
Assert.assertEquals("Unexpected nom. ref.", "My prot. abb. tit. in a bk.: pp. 44. 1893", generic1.getNomenclaturalCitation("pp. 44")); |
|
573 | 394 |
} |
574 | 395 |
|
575 | 396 |
@Test |
... | ... | |
585 | 406 |
generic1.setAuthorship(genericTeam1); |
586 | 407 |
generic1.setTitleCache(null, false); //reset cache in case aspectJ is not enabled |
587 | 408 |
Assert.assertEquals("Unexpected title cache.", "Authorteam", generic1.getTitleCache()); |
588 |
Assert.assertEquals("", generic1.getNomenclaturalCitation(null)); |
|
589 | 409 |
} |
590 | 410 |
|
591 | 411 |
@Test |
... | ... | |
594 | 414 |
generic1.setDatePublished(TimePeriodParser.parseStringVerbatim("1792")); |
595 | 415 |
generic1.setTitleCache(null, false); //reset cache in case aspectJ is not enabled |
596 | 416 |
Assert.assertEquals("Unexpected title cache.", "Authorteam, 1792", generic1.getTitleCache()); |
597 |
Assert.assertEquals("1792", generic1.getNomenclaturalCitation(null)); |
|
598 |
} |
|
599 |
|
|
600 |
@Test |
|
601 |
public void testGenericDoubleDotBeforeYear(){ |
|
602 |
generic1.setAuthorship(genericTeam1); |
|
603 |
String detail = "sine no."; |
|
604 |
generic1.setAbbrevTitle("My title"); |
|
605 |
generic1.setDatePublished(TimePeriodParser.parseStringVerbatim("1883-1884")); |
|
606 |
generic1.setTitleCache(null, false); //reset cache in case aspectJ is not enabled |
|
607 |
Assert.assertEquals("My title: sine no. 1883"+SEP+"1884", generic1.getNomenclaturalCitation(detail)); |
|
608 | 417 |
} |
609 | 418 |
|
610 | 419 |
//#4338 |
... | ... | |
614 | 423 |
generic1.setAuthorship(genericTeam1); |
615 | 424 |
generic1.setDatePublished(TimePeriodParser.parseStringVerbatim("1883-1884")); |
616 | 425 |
generic1.setTitleCache(null, false); //reset cache in case aspectJ is not enabled |
617 |
Assert.assertEquals("My generic: 55. 1883"+SEP+"1884", generic1.getNomenclaturalCitation(detail1)); |
|
618 | 426 |
generic1.setVolume("7"); |
619 |
Assert.assertEquals("My generic 7: 55. 1883"+SEP+"1884", generic1.getNomenclaturalCitation(detail1)); |
|
620 | 427 |
Assert.assertEquals("Authorteam, My generic 7. 1883"+SEP+"1884", generic1.getTitleCache()); |
621 | 428 |
Assert.assertEquals("AT., My generic 7. 1883"+SEP+"1884", generic1.getAbbrevTitleCache()); |
622 | 429 |
|
... | ... | |
629 | 436 |
generic1.setInReference(generic2); |
630 | 437 |
|
631 | 438 |
//only reference has a volume |
632 |
Assert.assertEquals("in InRefAuthor, My InRef 7: 55. 1883"+SEP+"1884", generic1.getNomenclaturalCitation(detail1)); |
|
439 |
// Assert.assertEquals("in InRefAuthor, My InRef 7: 55. 1883"+SEP+"1884", generic1.getNomenclaturalCitation(detail1));
|
|
633 | 440 |
// Assert.assertEquals("Authorteam - My generic in InRefAuthor, My InRef 7. 1883-1884", generic1.getTitleCache()); |
634 | 441 |
// Assert.assertEquals("AT. - My generic in InRefAuthor, My InRef 7. 1883-1884", generic1.getAbbrevTitleCache()); |
635 | 442 |
|
636 | 443 |
//both have a volume |
637 | 444 |
generic2.setVolume("9"); //still unclear what should happen if you have such dirty data |
638 |
// Assert.assertEquals("in InRefAuthor, My InRef 7: 55. 1883-1884", generic1.getNomenclaturalCitation(detail1)); |
|
639 | 445 |
// Assert.assertEquals("Authorteam - My generic in InRefAuthor, My InRef 7. 1883-1884", generic1.getTitleCache()); |
640 | 446 |
// Assert.assertEquals("AT. - My generic in InRefAuthor, My InRef 7. 1883-1884", generic1.getAbbrevTitleCache()); |
641 | 447 |
|
642 | 448 |
//only inref has volume |
643 | 449 |
generic1.setVolume(null); |
644 |
Assert.assertEquals("in InRefAuthor, My InRef 9: 55. 1883"+SEP+"1884", generic1.getNomenclaturalCitation(detail1)); |
|
645 | 450 |
Assert.assertEquals("Authorteam - My generic. "+UTF8.EN_DASH+" In: InRefAuthor, My InRef 9. 1883"+SEP+"1884", generic1.getTitleCache()); |
646 | 451 |
Assert.assertEquals("AT. - My generic. "+UTF8.EN_DASH+" In: InRefAuthor, My InRef 9. 1883"+SEP+"1884", generic1.getAbbrevTitleCache()); |
647 | 452 |
} |
648 | 453 |
|
649 |
//#3532 |
|
650 |
@Test |
|
651 |
public void testUnexpectedNomenclaturalReferences(){ |
|
652 |
Reference reference; |
|
653 |
|
|
654 |
//database |
|
655 |
IDatabase database1 = ReferenceFactory.newDatabase(); |
|
656 |
reference = (Reference)database1; |
|
657 |
|
|
658 |
database1.setTitle("My database"); |
|
659 |
//maybe we should have a trailing dot here |
|
660 |
Assert.assertEquals("My database: 55", reference.getNomenclaturalCitation(detail1)); |
|
661 |
database1.setDatePublished(TimePeriodParser.parseStringVerbatim("1998")); |
|
662 |
Assert.assertEquals("My database: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
663 |
|
|
664 |
database1.setTitleCache("Your database", true); |
|
665 |
Assert.assertEquals("My database: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
666 |
|
|
667 |
//unclear if it is wanted that the year is shown, though the abbrev cache is protected, probably not |
|
668 |
reference.setAbbrevTitleCache("You. Db.", true); |
|
669 |
Assert.assertEquals("You. Db.: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
670 |
|
|
671 |
|
|
672 |
//CD/DVD |
|
673 |
ICdDvd cdDvd = ReferenceFactory.newCdDvd(); |
|
674 |
reference= (Reference)cdDvd; |
|
675 |
cdDvd.setTitle("My Cd/Dvd"); |
|
676 |
//maybe we should have a trailing dot here |
|
677 |
Assert.assertEquals("My Cd/Dvd: 55", reference.getNomenclaturalCitation(detail1)); |
|
678 |
cdDvd.setDatePublished(TimePeriodParser.parseStringVerbatim("1998")); |
|
679 |
Assert.assertEquals("My Cd/Dvd: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
680 |
|
|
681 |
cdDvd.setTitleCache("Your Cd/Dvd", true); |
|
682 |
Assert.assertEquals("My Cd/Dvd: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
683 |
|
|
684 |
//unclear if it is wanted that the year is shown, though the abbrev cache is protected, probably not |
|
685 |
reference.setAbbrevTitleCache("You. Cd.", true); |
|
686 |
Assert.assertEquals("You. Cd.: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
687 |
|
|
688 |
|
|
689 |
//WebSite |
|
690 |
IWebPage webPage = ReferenceFactory.newWebPage(); |
|
691 |
reference= (Reference)webPage; |
|
692 |
webPage.setTitle("My WebPage"); |
|
693 |
//maybe we should have a trailing dot here |
|
694 |
Assert.assertEquals("My WebPage: 55", reference.getNomenclaturalCitation(detail1)); |
|
695 |
webPage.setDatePublished(TimePeriodParser.parseStringVerbatim("1998")); |
|
696 |
Assert.assertEquals("My WebPage: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
697 |
|
|
698 |
webPage.setTitleCache("Your WebPage", true); |
|
699 |
Assert.assertEquals("My WebPage: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
700 |
|
|
701 |
//unclear if it is wanted that the year is shown, though the abbrev cache is protected, probably not |
|
702 |
reference.setAbbrevTitleCache("You. WP.", true); |
|
703 |
Assert.assertEquals("You. WP.: 55. 1998", reference.getNomenclaturalCitation(detail1)); |
|
704 |
|
|
705 |
//uri |
|
706 |
webPage = ReferenceFactory.newWebPage(); |
|
707 |
reference= (Reference)webPage; |
|
708 |
webPage.setUri(URI.create("http://www.abc.de")); |
|
709 |
Assert.assertEquals("http://www.abc.de: 55", reference.getNomenclaturalCitation(detail1)); |
|
710 |
|
|
711 |
//TBC |
|
712 |
} |
|
713 |
|
|
714 | 454 |
// ********************************** WEB PAGE ********************************************/ |
715 | 455 |
|
716 | 456 |
@Test |
Also available in: Unified diff
fix #9604 bibliographic ReferenceDefaultCacheStrategy and NomenclaturalSourceFormatter splittet