Project

General

Profile

« Previous | Next » 

Revision c80fe770

Added by Andreas Müller almost 4 years ago

ref #9157 handle articles and book sections matching stricter

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/match/MatchStrategyFactoryTest.java
16 16
import org.junit.BeforeClass;
17 17
import org.junit.Test;
18 18

  
19
import eu.etaxonomy.cdm.common.DOI;
19 20
import eu.etaxonomy.cdm.model.agent.Institution;
20 21
import eu.etaxonomy.cdm.model.agent.Person;
21 22
import eu.etaxonomy.cdm.model.agent.Team;
......
260 261
        parsedBook = getDefaultParsedBook();
261 262
        Assert.assertTrue("Same abbrev. title should match",
262 263
                matchStrategy.invoke(parsedBook, fullBook).isSuccessful());
264
        fullBook.setDoi(DOI.fromString("10.1234/abc"));
265
        Assert.assertTrue("DOI only with full book should match as abbrev title identifies the book",
266
                matchStrategy.invoke(parsedBook, fullBook).isSuccessful());
263 267

  
264 268
        //differing nom. title.
265 269
        parsedBook.setAbbrevTitle("Wrong");
......
301 305
        parsedBookSection = getDefaultParsedBookSection();
302 306
        Assert.assertTrue("Only author, book and date published should match",
303 307
                matchStrategy.invoke(parsedBookSection, fullBookSection).isSuccessful() );
308
        fullBookSection.setDoi(DOI.fromString("10.1234/abc"));
309
        Assert.assertFalse("Full book section having additional parameters should not match if parsed article has no identifying parameter like (abbrev)title or page",
310
                matchStrategy.invoke(parsedBookSection, fullBookSection).isSuccessful());
311
        fullBookSection.setDoi(null);
312
        fullBookSection.setReferenceAbstract("My abstract");
313
        Assert.assertFalse("Full book section having additional parameters should not match if parsed article has no identifying parameter like (abbrev)title or page",
314
                matchStrategy.invoke(parsedBookSection, fullBookSection).isSuccessful());
304 315

  
305 316
        //should match
306 317
        fullBookSection = getDefaultFullBookSection();
......
399 410

  
400 411
        fullArticle = getMatchingFullArticle();
401 412
        parsedArticle = getDefaultParsedArticle();
402
        Assert.assertTrue("Only author, book and date published should match",
403
                matchStrategy.invoke(parsedArticle, fullArticle).isSuccessful() );
413
        Assert.assertTrue("Having only paramters both have in common like author, book and date published "
414
                + "should match", matchStrategy.invoke(parsedArticle, fullArticle).isSuccessful());
415
        fullArticle.setDoi(DOI.fromString("10.1234/abc"));
416
        Assert.assertFalse("Full article having additional parameters should not match if parsed article has no identifying parameter like (abbrev)title or page",
417
                matchStrategy.invoke(parsedArticle, fullArticle).isSuccessful());
404 418

  
405
        //should match
419
        //no match due to missing abbrev title match
406 420
        fullArticle = getDefaultFullArticle();
407 421
        Assert.assertFalse("Abbrev. title must be equal or null", matchStrategy.invoke(parsedArticle,
408 422
                fullArticle).isSuccessful());
409 423
        parsedArticle.setAbbrevTitle(fullArticle.getAbbrevTitle());
410 424
        Assert.assertFalse("Still not match because pages are not equal (parsed is null)",
411 425
                matchStrategy.invoke(parsedArticle, fullArticle).isSuccessful());
426
        //FIXME in future this should not fail, but parsed articles never have really pages, they only have page or a page span in the parsed detail which is not the same as the pages of the article
412 427
        parsedArticle.setPages(fullArticle.getPages());
413 428
        Assert.assertFalse("Now they should match",
414 429
                matchStrategy.invoke(parsedArticle, fullArticle).isSuccessful());

Also available in: Unified diff