Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new test for different articles from the same book in DuplicateCeckTest #9769

Merged
merged 4 commits into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/test/java/org/jabref/logic/database/DuplicateCheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.jabref.model.entry.types.StandardEntryType;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -327,4 +328,34 @@ void compareOfTwoEntriesWithSameContentAndMixedLineEndingsReportsNoDifferences()
BibEntry entryTwo = new BibEntry().withField(StandardField.COMMENT, "line1\r\n\r\nline3\r\n\r\nline5");
assertTrue(duplicateChecker.isDuplicate(entryOne, entryTwo, BibDatabaseMode.BIBTEX));
}

@Disabled("Book entries can have the same ISBN due to different chapters. The Test fails as crossref identifies both entries as the same.")
@Test
void differentArticlesFromTheSameBookAreNotDuplicates() {
BibEntry entryOne = new BibEntry(StandardEntryType.Article)
.withCitationKey("Atkinson_1993")
.withField(StandardField.AUTHOR, "Richard Atkinson")
.withField(StandardField.CHAPTER, "11")
.withField(StandardField.PAGES, "91-100")
.withField(StandardField.TITLE, "Performance on a Signal")
.withField(StandardField.BOOKTITLE, "ABC")
.withField(StandardField.EDITOR, "ABC")
.withField(StandardField.PUBLISHER, "ABC")
.withField(StandardField.ISBN, "978-1-4684-8585-1")
.withField(StandardField.YEAR, "1993");

BibEntry entryTwo = new BibEntry(StandardEntryType.Article)
.withCitationKey("Ballard_1993")
.withField(StandardField.AUTHOR, "Elizabeth Ballard")
.withField(StandardField.CHAPTER, "20")
.withField(StandardField.PAGES, "187-203")
.withField(StandardField.TITLE, "Rest in Treatment")
.withField(StandardField.BOOKTITLE, "ABC")
.withField(StandardField.EDITOR, "ABC")
.withField(StandardField.PUBLISHER, "ABC")
.withField(StandardField.ISBN, "978-1-4684-8585-1")
.withField(StandardField.YEAR, "1993");

assertFalse(duplicateChecker.isDuplicate(entryOne, entryTwo, BibDatabaseMode.BIBTEX));
}
}