Project

General

Profile

« Previous | Next » 

Revision cd37bc26

Added by Andreas Müller almost 3 years ago

ref #9326, ref #3764 fix secion in book-section handling and some cleanup in ReferenceDefaultCacheStrategy (cont.)

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/reference/ReferenceDefaultCacheStrategyTest.java
132 132
	public void testArticleGetTitleCache(){
133 133
		journal1.setTitle("My journal");
134 134
		((Reference)journal1).setAuthorship(articleTeam2);  //incorrect use anyway
135
		article1.setTitle("My article");
136 135
		article1.setInJournal(journal1);
137 136
		article1.setAuthorship(articleTeam1);
138 137
		article1.setDatePublished(VerbatimTimePeriod.NewVerbatimInstance(1975));
138
	    Assert.assertEquals("Team1 1975: "+UTF8.EN_DASH+" My journal.", article1.getTitleCache());
139
	    article1.setTitle("My article");
139 140
		Assert.assertEquals("Team1 1975: My article. "+UTF8.EN_DASH+" My journal.", article1.getTitleCache());
140 141

  
141 142
		article1.setInJournal(null);
......
375 376
        article.setAuthorship(articleTeam);
376 377
        article.setInJournal(journal);
377 378
        article.setVolume("452(1)");
378
        article.setVolume("83-91");
379
        article.setPages("83-91");
379 380
        article.setDatePublished(TimePeriodParser.parseStringVerbatim("8 Jul 2020"));
380 381
        article.setDoi(DOI.fromString("10.11646/phytotaxa.452.1.8"));
381 382
        Reference section = ReferenceFactory.newSection();
......
384 385
        section.setInReference(article);
385 386

  
386 387
        Assert.assertEquals("Unexpected title cache.",
387
                "Chudaev, D.A., Glushchenko, A., Kulikovskiy, M. & Kociolek, J.P. 2020 – In: "
388
                + "Kulikovskiy, M., Chudaev, D.A., Glushchenko, A., Kuznetsova, I. & Kociolek, J.P., New diatom species Navicula davidovichii from Vietnam (Southeast Asia). – Phytotaxa 83-91.", section.getTitleCache());
388
                "Chudaev, D.A., Glushchenko, A., Kulikovskiy, M. & Kociolek, J.P. 2020 "+UTF8.EN_DASH+" In: "
389
                + "Kulikovskiy, M., Chudaev, D.A., Glushchenko, A., Kuznetsova, I. & Kociolek, J.P., "
390
                + "New diatom species Navicula davidovichii from Vietnam (Southeast Asia). "+UTF8.EN_DASH+" Phytotaxa 452(1).",
391
                section.getTitleCache());
392
    }
393

  
394
    @Test
395
    public void testSectionInBookSection(){
396
        //#9326, #3764
397
        Reference book = ReferenceFactory.newBook();
398
        book.setTitle("Species Plantarum");
399
        Team bookAuthor = Team.NewTitledInstance("Linne", null);
400
        book.setAuthorship(bookAuthor);
401
        book.setVolume("3");
402
        Reference bookSection = ReferenceFactory.newBookSection();
403
        String bookSectionTitle = "Trees";
404
        bookSection.setTitle(bookSectionTitle);
405
        Team bookSectionTeam = Team.NewTitledInstance("Chapter author", null);
406
        bookSection.setAuthorship(bookSectionTeam);
407
        bookSection.setInBook(book);
408
        bookSection.setPages("83-91");
409
        bookSection.setDatePublished(TimePeriodParser.parseStringVerbatim("1752"));
410
        bookSection.setDoi(DOI.fromString("10.12345/speciesplantarum.3"));
411
        Reference section = ReferenceFactory.newSection();
412
        Team sectionTeam = Team.NewTitledInstance("Section author", null);
413
        section.setAuthorship(sectionTeam);
414
        section.setInReference(bookSection);
415

  
416
        Assert.assertEquals("Unexpected title cache.",
417
                "Section author 1752 "+UTF8.EN_DASH+" In: Chapter author, Trees, pp. 83-91. "+UTF8.EN_DASH+" In: Linne, Species Plantarum 3.",
418
                section.getTitleCache());
389 419
    }
390 420

  
391 421
    @Test

Also available in: Unified diff