From ce72cb6062901bbe0b626eeb725f1028794fd3b5 Mon Sep 17 00:00:00 2001 From: Stanley F Date: Tue, 3 Sep 2019 15:18:13 +0200 Subject: [PATCH 1/7] implement field inheritance for crossref-relationships * based on biblatex inheritance rules (c.f. doc appendix B) * fixes JabRef/jabref#5045 --- .../java/org/jabref/model/entry/BibEntry.java | 126 ++++++++++++++++-- 1 file changed, 113 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 85adabb0ed7..1a19c95baa8 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -32,6 +32,7 @@ import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.identifier.DOI; import org.jabref.model.entry.types.EntryType; +import org.jabref.model.entry.types.IEEETranEntryType; import org.jabref.model.entry.types.StandardEntryType; import org.jabref.model.strings.LatexToUnicodeAdapter; import org.jabref.model.strings.StringUtil; @@ -112,6 +113,110 @@ public Optional getResolvedFieldOrAlias(OrFields fields, BibDatabase dat return Optional.empty(); } + /** + * Map an (empty) field of a BibEntry to a field of a cross-referenced entry. + * + * @param targetField field name of the BibEntry + * @param targetEntry type of the BibEntry + * @param sourceEntry type of the cross-referenced BibEntry + * + * @return the mapped field or null if there is no valid mapping available + */ + private Field getSourceField(Field targetField, EntryType targetEntry, EntryType sourceEntry) { + //// 1. Sort out forbidden fields + if ((targetField == StandardField.IDS) || + (targetField == StandardField.CROSSREF) || + (targetField == StandardField.XREF) || + (targetField == StandardField.ENTRYSET) || + (targetField == StandardField.RELATED) || + (targetField == StandardField.SORTKEY)) { + return null; + } + + //// 2. Handle special field mappings + if ((sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.InBook) || + (sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.BookInBook) || + (sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.SuppBook) || + (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.InBook) || + (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.BookInBook) || + (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.SuppBook)) { + if (targetField == StandardField.AUTHOR) { return StandardField.AUTHOR; } + if (targetField == StandardField.BOOKAUTHOR) { return StandardField.AUTHOR; } + } + + if ((sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.Book) || + (sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.InBook) || + (sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.BookInBook) || + (sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.SuppBook) || + (sourceEntry == StandardEntryType.MvCollection && targetEntry == StandardEntryType.Collection) || + (sourceEntry == StandardEntryType.MvCollection && targetEntry == StandardEntryType.InCollection) || + (sourceEntry == StandardEntryType.MvCollection && targetEntry == StandardEntryType.SuppCollection) || + (sourceEntry == StandardEntryType.MvProceedings && targetEntry == StandardEntryType.Proceedings) || + (sourceEntry == StandardEntryType.MvProceedings && targetEntry == StandardEntryType.InProceedings) || + (sourceEntry == StandardEntryType.MvReference && targetEntry == StandardEntryType.Reference) || + (sourceEntry == StandardEntryType.MvReference && targetEntry == StandardEntryType.InReference)) { + if (targetField == StandardField.MAINTITLE) { return StandardField.TITLE; } + if (targetField == StandardField.MAINSUBTITLE) { return StandardField.SUBTITLE; } + if (targetField == StandardField.MAINTITLEADDON) { return StandardField.TITLEADDON; } + + // those fields are no more available for the same-name inheritance strategy + if ((targetField == StandardField.TITLE) || + (targetField == StandardField.SUBTITLE) || + (targetField == StandardField.TITLEADDON)) { + return null; + } + + // for these fields, inheritance is not allowed for the specified entry types + if ((targetField == StandardField.SHORTTITLE)) { + return null; + } + } + + if ((sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.InBook) || + (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.BookInBook) || + (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.SuppBook) || + (sourceEntry == StandardEntryType.Collection && targetEntry == StandardEntryType.InCollection) || + (sourceEntry == StandardEntryType.Collection && targetEntry == StandardEntryType.SuppCollection) || + (sourceEntry == StandardEntryType.Reference && targetEntry == StandardEntryType.InReference) || + (sourceEntry == StandardEntryType.Proceedings && targetEntry == StandardEntryType.InProceedings)) { + if (targetField == StandardField.BOOKTITLE) { return StandardField.TITLE; } + if (targetField == StandardField.BOOKSUBTITLE) { return StandardField.SUBTITLE; } + if (targetField == StandardField.BOOKTITLEADDON) { return StandardField.TITLEADDON; } + + // those fields are no more available for the same-name inheritance strategy + if ((targetField == StandardField.TITLE) || + (targetField == StandardField.SUBTITLE) || + (targetField == StandardField.TITLEADDON)) { + return null; + } + + // for these fields, inheritance is not allowed for the specified entry types + if ((targetField == StandardField.SHORTTITLE)) { + return null; + } + } + + if ((sourceEntry == IEEETranEntryType.Periodical && targetEntry == StandardEntryType.Article) || + (sourceEntry == IEEETranEntryType.Periodical && targetEntry == StandardEntryType.SuppPeriodical)) { + if (targetField == StandardField.JOURNALTITLE) { return StandardField.TITLE; } + if (targetField == StandardField.JOURNALSUBTITLE) { return StandardField.SUBTITLE; } + + // those fields are no more available for the same-name inheritance strategy + if ((targetField == StandardField.TITLE) || + (targetField == StandardField.SUBTITLE)) { + return null; + } + + // for these fields, inheritance is not allowed for the specified entry types + if ((targetField == StandardField.SHORTTITLE)) { + return null; + } + } + + //// 3. Fallback to inherit the field with the same name. + return targetField; + } + /** * Returns the text stored in the given field of the given bibtex entry * which belongs to the given database. @@ -137,21 +242,16 @@ public Optional getResolvedFieldOrAlias(Field field, BibDatabase databas Optional result = getFieldOrAlias(field); // If this field is not set, and the entry has a crossref, try to look up the - // field in the referred entry: Do not do this for the bibtex key. - if (!result.isPresent() && (database != null)) { + // field in the referred entry, following the biblatex rules + if (result.isEmpty() && (database != null)) { Optional referred = database.getReferencedEntry(this); if (referred.isPresent()) { - result = referred.get().getFieldOrAlias(field); - if (!result.isPresent() && type.equals(StandardEntryType.InProceedings)) { - if (field == StandardField.BOOKTITLE) { - result = referred.get().getFieldOrAlias(StandardField.TITLE); - } - else if (field == StandardField.BOOKSUBTITLE) { - result = referred.get().getFieldOrAlias(StandardField.SUBTITLE); - } - else if (field == StandardField.BOOKAUTHOR) { - result = referred.get().getFieldOrAlias(StandardField.AUTHOR); - } + EntryType sourceEntry = referred.get().type.get(); + EntryType targetEntry = type.get(); + Field sourceField = getSourceField(field, targetEntry, sourceEntry); + + if (sourceField != null) { + result = referred.get().getFieldOrAlias(sourceField); } } } From b966777f1ee40365b83ac3b2a63b8553e8eadb71 Mon Sep 17 00:00:00 2001 From: Stanley F Date: Thu, 5 Sep 2019 13:25:02 +0200 Subject: [PATCH 2/7] add simple test cases for crossref inheritance --- .../org/jabref/model/entry/CrossrefTest.java | 85 +++++++++++++++++++ .../org/jabref/model/entry/crossref.bib | 14 +++ 2 files changed, 99 insertions(+) create mode 100644 src/test/java/org/jabref/model/entry/CrossrefTest.java create mode 100644 src/test/resources/org/jabref/model/entry/crossref.bib diff --git a/src/test/java/org/jabref/model/entry/CrossrefTest.java b/src/test/java/org/jabref/model/entry/CrossrefTest.java new file mode 100644 index 00000000000..9e304508c0b --- /dev/null +++ b/src/test/java/org/jabref/model/entry/CrossrefTest.java @@ -0,0 +1,85 @@ +package org.jabref.model.entry; + +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.jabref.logic.importer.ImportException; +import org.jabref.logic.importer.ImportFormatPreferences; +import org.jabref.logic.importer.ImportFormatReader; +import org.jabref.logic.xmp.XmpPreferences; +import org.jabref.model.database.BibDatabase; +import org.jabref.model.entry.field.StandardField; +import org.jabref.model.util.DummyFileUpdateMonitor; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.mockito.Answers; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +class CrossrefTest { + + private static BibDatabase database; + + @BeforeAll + static void SetUp() throws ImportException, URISyntaxException { + ImportFormatReader reader = new ImportFormatReader(); + ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); + when(importFormatPreferences.getEncoding()).thenReturn(StandardCharsets.UTF_8); + reader.resetImportFormats(importFormatPreferences, mock(XmpPreferences.class), new DummyFileUpdateMonitor()); + + Path file = Paths.get(CrossrefTest.class.getResource("crossref.bib").toURI()); + database = reader.importFromFile("bibtex", file).getDatabase(); + } + + private BibEntry getEntry(String key) { + var entries = database.getEntriesByKey(key); + assertEquals(1, entries.size()); + return entries.get(0); + } + + @Test + void inproceedings_proceedings_inheritance() { + var source = getEntry("pr_001"); + var target = getEntry("inpr_001"); + + assertEquals( + source.getResolvedFieldOrAlias(StandardField.YEAR, database), + target.getResolvedFieldOrAlias(StandardField.YEAR, database) + ); + + assertEquals( + source.getResolvedFieldOrAlias(StandardField.TITLE, database), + target.getResolvedFieldOrAlias(StandardField.BOOKTITLE, database) + ); + } + + @Test + void inproceedings_proceedings_no_inheritance() { + var target = getEntry("inpr_001"); + + assertFalse(target.getResolvedFieldOrAlias(StandardField.TITLE, database).isPresent()); + } + + @Test + void inproceedings_proceedings_no_overwrite() { + var source = getEntry("pr_001"); + var target = getEntry("inpr_002"); + + assertNotEquals( + source.getResolvedFieldOrAlias(StandardField.YEAR, database), + target.getResolvedFieldOrAlias(StandardField.YEAR, database) + ); + + assertNotEquals( + source.getResolvedFieldOrAlias(StandardField.TITLE, database), + target.getResolvedFieldOrAlias(StandardField.BOOKTITLE, database) + ); + } +} diff --git a/src/test/resources/org/jabref/model/entry/crossref.bib b/src/test/resources/org/jabref/model/entry/crossref.bib new file mode 100644 index 00000000000..affe9946898 --- /dev/null +++ b/src/test/resources/org/jabref/model/entry/crossref.bib @@ -0,0 +1,14 @@ +@Proceedings{pr_001, + title = {Proceedings_001}, + year = {2019}, +} + +@InProceedings{inpr_001, + crossref = {pr_001}, +} + +@InProceedings{inpr_002, + crossref = {pr_001}, + booktitle = {foobar}, + year = {42} +} From 970222337d9ad0c9a17e484976e6ac4379a1832d Mon Sep 17 00:00:00 2001 From: Stanley F Date: Thu, 5 Sep 2019 13:29:04 +0200 Subject: [PATCH 3/7] add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c9853c1f24..261e8c53e9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ### Fixed +- Inherit fields from cross-referenced entries as specified by biblatex [#5045](https://github.com/JabRef/jabref/issues/5045) + ### Removed From cad21922459b572babd987f647e00a2e31a84baa Mon Sep 17 00:00:00 2001 From: Stanley F Date: Mon, 9 Sep 2019 12:34:23 +0200 Subject: [PATCH 4/7] return Optional to avoid plain null --- .../java/org/jabref/model/entry/BibEntry.java | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 1a19c95baa8..de36489fc52 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -122,7 +122,7 @@ public Optional getResolvedFieldOrAlias(OrFields fields, BibDatabase dat * * @return the mapped field or null if there is no valid mapping available */ - private Field getSourceField(Field targetField, EntryType targetEntry, EntryType sourceEntry) { + private Optional getSourceField(Field targetField, EntryType targetEntry, EntryType sourceEntry) { //// 1. Sort out forbidden fields if ((targetField == StandardField.IDS) || (targetField == StandardField.CROSSREF) || @@ -130,7 +130,7 @@ private Field getSourceField(Field targetField, EntryType targetEntry, EntryType (targetField == StandardField.ENTRYSET) || (targetField == StandardField.RELATED) || (targetField == StandardField.SORTKEY)) { - return null; + return Optional.empty(); } //// 2. Handle special field mappings @@ -140,8 +140,8 @@ private Field getSourceField(Field targetField, EntryType targetEntry, EntryType (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.InBook) || (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.BookInBook) || (sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.SuppBook)) { - if (targetField == StandardField.AUTHOR) { return StandardField.AUTHOR; } - if (targetField == StandardField.BOOKAUTHOR) { return StandardField.AUTHOR; } + if (targetField == StandardField.AUTHOR) { return Optional.of(StandardField.AUTHOR); } + if (targetField == StandardField.BOOKAUTHOR) { return Optional.of(StandardField.AUTHOR); } } if ((sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.Book) || @@ -155,20 +155,20 @@ private Field getSourceField(Field targetField, EntryType targetEntry, EntryType (sourceEntry == StandardEntryType.MvProceedings && targetEntry == StandardEntryType.InProceedings) || (sourceEntry == StandardEntryType.MvReference && targetEntry == StandardEntryType.Reference) || (sourceEntry == StandardEntryType.MvReference && targetEntry == StandardEntryType.InReference)) { - if (targetField == StandardField.MAINTITLE) { return StandardField.TITLE; } - if (targetField == StandardField.MAINSUBTITLE) { return StandardField.SUBTITLE; } - if (targetField == StandardField.MAINTITLEADDON) { return StandardField.TITLEADDON; } + if (targetField == StandardField.MAINTITLE) { return Optional.of(StandardField.TITLE); } + if (targetField == StandardField.MAINSUBTITLE) { return Optional.of(StandardField.SUBTITLE); } + if (targetField == StandardField.MAINTITLEADDON) { return Optional.of(StandardField.TITLEADDON); } // those fields are no more available for the same-name inheritance strategy if ((targetField == StandardField.TITLE) || (targetField == StandardField.SUBTITLE) || (targetField == StandardField.TITLEADDON)) { - return null; + return Optional.empty(); } // for these fields, inheritance is not allowed for the specified entry types if ((targetField == StandardField.SHORTTITLE)) { - return null; + return Optional.empty(); } } @@ -179,42 +179,42 @@ private Field getSourceField(Field targetField, EntryType targetEntry, EntryType (sourceEntry == StandardEntryType.Collection && targetEntry == StandardEntryType.SuppCollection) || (sourceEntry == StandardEntryType.Reference && targetEntry == StandardEntryType.InReference) || (sourceEntry == StandardEntryType.Proceedings && targetEntry == StandardEntryType.InProceedings)) { - if (targetField == StandardField.BOOKTITLE) { return StandardField.TITLE; } - if (targetField == StandardField.BOOKSUBTITLE) { return StandardField.SUBTITLE; } - if (targetField == StandardField.BOOKTITLEADDON) { return StandardField.TITLEADDON; } + if (targetField == StandardField.BOOKTITLE) { return Optional.of(StandardField.TITLE); } + if (targetField == StandardField.BOOKSUBTITLE) { return Optional.of(StandardField.SUBTITLE); } + if (targetField == StandardField.BOOKTITLEADDON) { return Optional.of(StandardField.TITLEADDON); } // those fields are no more available for the same-name inheritance strategy if ((targetField == StandardField.TITLE) || (targetField == StandardField.SUBTITLE) || (targetField == StandardField.TITLEADDON)) { - return null; + return Optional.empty(); } // for these fields, inheritance is not allowed for the specified entry types if ((targetField == StandardField.SHORTTITLE)) { - return null; + return Optional.empty(); } } if ((sourceEntry == IEEETranEntryType.Periodical && targetEntry == StandardEntryType.Article) || (sourceEntry == IEEETranEntryType.Periodical && targetEntry == StandardEntryType.SuppPeriodical)) { - if (targetField == StandardField.JOURNALTITLE) { return StandardField.TITLE; } - if (targetField == StandardField.JOURNALSUBTITLE) { return StandardField.SUBTITLE; } + if (targetField == StandardField.JOURNALTITLE) { return Optional.of(StandardField.TITLE); } + if (targetField == StandardField.JOURNALSUBTITLE) { return Optional.of(StandardField.SUBTITLE); } // those fields are no more available for the same-name inheritance strategy if ((targetField == StandardField.TITLE) || (targetField == StandardField.SUBTITLE)) { - return null; + return Optional.empty(); } // for these fields, inheritance is not allowed for the specified entry types if ((targetField == StandardField.SHORTTITLE)) { - return null; + return Optional.empty(); } } //// 3. Fallback to inherit the field with the same name. - return targetField; + return Optional.ofNullable(targetField); } /** @@ -248,10 +248,10 @@ public Optional getResolvedFieldOrAlias(Field field, BibDatabase databas if (referred.isPresent()) { EntryType sourceEntry = referred.get().type.get(); EntryType targetEntry = type.get(); - Field sourceField = getSourceField(field, targetEntry, sourceEntry); + Optional sourceField = getSourceField(field, targetEntry, sourceEntry); - if (sourceField != null) { - result = referred.get().getFieldOrAlias(sourceField); + if (sourceField.isPresent()) { + result = referred.get().getFieldOrAlias(sourceField.get()); } } } From 345cbfb1a1a22ee80ec69473336fb73a04c86344 Mon Sep 17 00:00:00 2001 From: Stanley F Date: Mon, 9 Sep 2019 14:11:42 +0200 Subject: [PATCH 5/7] reworked crossref tests * create test data programmatically * tests for special inheritance rules * tests for same name field inheritance for one entry type combination --- .../org/jabref/model/entry/CrossrefTest.java | 367 +++++++++++++++--- .../org/jabref/model/entry/crossref.bib | 14 - 2 files changed, 315 insertions(+), 66 deletions(-) delete mode 100644 src/test/resources/org/jabref/model/entry/crossref.bib diff --git a/src/test/java/org/jabref/model/entry/CrossrefTest.java b/src/test/java/org/jabref/model/entry/CrossrefTest.java index 9e304508c0b..929b9d5167f 100644 --- a/src/test/java/org/jabref/model/entry/CrossrefTest.java +++ b/src/test/java/org/jabref/model/entry/CrossrefTest.java @@ -1,85 +1,348 @@ package org.jabref.model.entry; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.jabref.logic.importer.ImportException; -import org.jabref.logic.importer.ImportFormatPreferences; -import org.jabref.logic.importer.ImportFormatReader; -import org.jabref.logic.xmp.XmpPreferences; +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; + import org.jabref.model.database.BibDatabase; import org.jabref.model.entry.field.StandardField; -import org.jabref.model.util.DummyFileUpdateMonitor; +import org.jabref.model.entry.types.EntryType; +import org.jabref.model.entry.types.IEEETranEntryType; +import org.jabref.model.entry.types.StandardEntryType; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.mockito.Answers; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import static org.junit.jupiter.api.Assertions.assertTrue; class CrossrefTest { - private static BibDatabase database; + private BibEntry parent; + private BibEntry child; + private BibDatabase db; + + @BeforeEach + void setup() { + parent = new BibEntry(StandardEntryType.Proceedings); + parent.setCiteKey("parent"); + parent.setField(StandardField.IDS, "parent_IDS"); + parent.setField(StandardField.XREF, "parent_XREF"); + parent.setField(StandardField.ENTRYSET, "parent_ENTRYSET"); + parent.setField(StandardField.RELATED, "parent_RELATED"); + parent.setField(StandardField.SORTKEY, "parent_SORTKEY"); + + parent.setField(StandardField.AUTHOR, "parent_AUTHOR"); + + parent.setField(StandardField.TITLE, "parent_TITLE"); + parent.setField(StandardField.SUBTITLE, "parent_SUBTITLE"); + parent.setField(StandardField.TITLEADDON, "parent_TITLEADDON"); + parent.setField(StandardField.SHORTTITLE, "parent_SHORTTITLE"); - @BeforeAll - static void SetUp() throws ImportException, URISyntaxException { - ImportFormatReader reader = new ImportFormatReader(); - ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); - when(importFormatPreferences.getEncoding()).thenReturn(StandardCharsets.UTF_8); - reader.resetImportFormats(importFormatPreferences, mock(XmpPreferences.class), new DummyFileUpdateMonitor()); + child = new BibEntry(StandardEntryType.InProceedings); + child.setField(StandardField.CROSSREF, "parent"); - Path file = Paths.get(CrossrefTest.class.getResource("crossref.bib").toURI()); - database = reader.importFromFile("bibtex", file).getDatabase(); + db = new BibDatabase(Arrays.asList(parent, child)); } - private BibEntry getEntry(String key) { - var entries = database.getEntriesByKey(key); - assertEquals(1, entries.size()); - return entries.get(0); + + @ParameterizedTest + @EnumSource(value = StandardField.class, names = {"IDS", "XREF", "ENTRYSET", "RELATED", "SORTKEY"}) + void forbiddenFields(StandardField field) { + Optional childField = child.getResolvedFieldOrAlias(field, db); + assertTrue(childField.isEmpty()); } - @Test - void inproceedings_proceedings_inheritance() { - var source = getEntry("pr_001"); - var target = getEntry("inpr_001"); + @ParameterizedTest + @MethodSource("authorInheritanceSource") + void authorInheritance(EntryType parentType, EntryType childType) { + parent.setType(parentType); + child.setType(childType); assertEquals( - source.getResolvedFieldOrAlias(StandardField.YEAR, database), - target.getResolvedFieldOrAlias(StandardField.YEAR, database) + parent.getResolvedFieldOrAlias(StandardField.AUTHOR, null), + child.getResolvedFieldOrAlias(StandardField.AUTHOR, db) ); assertEquals( - source.getResolvedFieldOrAlias(StandardField.TITLE, database), - target.getResolvedFieldOrAlias(StandardField.BOOKTITLE, database) + parent.getResolvedFieldOrAlias(StandardField.AUTHOR, null), + child.getResolvedFieldOrAlias(StandardField.BOOKAUTHOR, db) + ); + } + + private static Stream authorInheritanceSource() { + return Stream.of( + Arguments.of(StandardEntryType.MvBook, StandardEntryType.InBook), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.BookInBook), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.SuppBook), + Arguments.of(StandardEntryType.Book, StandardEntryType.InBook), + Arguments.of(StandardEntryType.Book, StandardEntryType.BookInBook), + Arguments.of(StandardEntryType.Book, StandardEntryType.SuppBook) ); } - @Test - void inproceedings_proceedings_no_inheritance() { - var target = getEntry("inpr_001"); - assertFalse(target.getResolvedFieldOrAlias(StandardField.TITLE, database).isPresent()); + @ParameterizedTest + @MethodSource("mainTitleInheritanceSource") + void mainTitleInheritance(EntryType parentType, EntryType childType) { + parent.setType(parentType); + child.setType(childType); + + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.TITLE, null), + child.getResolvedFieldOrAlias(StandardField.MAINTITLE, db) + ); + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.SUBTITLE, null), + child.getResolvedFieldOrAlias(StandardField.MAINSUBTITLE, db) + ); + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.TITLEADDON, null), + child.getResolvedFieldOrAlias(StandardField.MAINTITLEADDON, db) + ); + } + + private static Stream mainTitleInheritanceSource() { + return Stream.of( + Arguments.of(StandardEntryType.MvBook, StandardEntryType.Book), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.InBook), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.BookInBook), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.SuppBook), + Arguments.of(StandardEntryType.MvCollection, StandardEntryType.Collection), + Arguments.of(StandardEntryType.MvCollection, StandardEntryType.InCollection), + Arguments.of(StandardEntryType.MvCollection, StandardEntryType.SuppCollection), + Arguments.of(StandardEntryType.MvProceedings, StandardEntryType.Proceedings), + Arguments.of(StandardEntryType.MvProceedings, StandardEntryType.InProceedings), + Arguments.of(StandardEntryType.MvReference, StandardEntryType.Reference), + Arguments.of(StandardEntryType.MvReference, StandardEntryType.InReference) + ); } - @Test - void inproceedings_proceedings_no_overwrite() { - var source = getEntry("pr_001"); - var target = getEntry("inpr_002"); - assertNotEquals( - source.getResolvedFieldOrAlias(StandardField.YEAR, database), - target.getResolvedFieldOrAlias(StandardField.YEAR, database) + @ParameterizedTest + @MethodSource("bookTitleInheritanceSource") + void bookTitleInheritance(EntryType parentType, EntryType childType) { + parent.setType(parentType); + child.setType(childType); + + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.TITLE, null), + child.getResolvedFieldOrAlias(StandardField.BOOKTITLE, db) + ); + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.SUBTITLE, null), + child.getResolvedFieldOrAlias(StandardField.BOOKSUBTITLE, db) + ); + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.TITLEADDON, null), + child.getResolvedFieldOrAlias(StandardField.BOOKTITLEADDON, db) + ); + } + + private static Stream bookTitleInheritanceSource() { + return Stream.of( + Arguments.of(StandardEntryType.Book, StandardEntryType.InBook), + Arguments.of(StandardEntryType.Book, StandardEntryType.BookInBook), + Arguments.of(StandardEntryType.Book, StandardEntryType.SuppBook), + Arguments.of(StandardEntryType.Collection, StandardEntryType.InCollection), + Arguments.of(StandardEntryType.Collection, StandardEntryType.SuppCollection), + Arguments.of(StandardEntryType.Reference, StandardEntryType.InReference), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings) ); + } + + + @ParameterizedTest + @MethodSource("journalTitleInheritanceSource") + void journalTitleInheritance(EntryType parentType, EntryType childType) { + parent.setType(parentType); + child.setType(childType); + + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.TITLE, null), + child.getResolvedFieldOrAlias(StandardField.JOURNALTITLE, db) + ); + assertEquals( + parent.getResolvedFieldOrAlias(StandardField.SUBTITLE, null), + child.getResolvedFieldOrAlias(StandardField.JOURNALSUBTITLE, db) + ); + } + + private static Stream journalTitleInheritanceSource() { + return Stream.of( + Arguments.of(IEEETranEntryType.Periodical, StandardEntryType.Article), + Arguments.of(IEEETranEntryType.Periodical, StandardEntryType.SuppPeriodical) + ); + } + + + @ParameterizedTest + @MethodSource("noTitleInheritanceSource") + void noTitleInheritance(EntryType parentType, EntryType childType) { + parent.setType(parentType); + child.setType(childType); + + assertTrue(child.getResolvedFieldOrAlias(StandardField.TITLE, db).isEmpty()); + assertTrue(child.getResolvedFieldOrAlias(StandardField.SUBTITLE, db).isEmpty()); + assertTrue(child.getResolvedFieldOrAlias(StandardField.TITLEADDON, db).isEmpty()); + assertTrue(child.getResolvedFieldOrAlias(StandardField.SHORTTITLE, db).isEmpty()); + } + + private static Stream noTitleInheritanceSource() { + return Stream.of( + Arguments.of(StandardEntryType.MvBook, StandardEntryType.Book), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.InBook), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.BookInBook), + Arguments.of(StandardEntryType.MvBook, StandardEntryType.SuppBook), + Arguments.of(StandardEntryType.MvCollection, StandardEntryType.Collection), + Arguments.of(StandardEntryType.MvCollection, StandardEntryType.InCollection), + Arguments.of(StandardEntryType.MvCollection, StandardEntryType.SuppCollection), + Arguments.of(StandardEntryType.MvProceedings, StandardEntryType.Proceedings), + Arguments.of(StandardEntryType.MvProceedings, StandardEntryType.InProceedings), + Arguments.of(StandardEntryType.MvReference, StandardEntryType.Reference), + Arguments.of(StandardEntryType.MvReference, StandardEntryType.InReference), + Arguments.of(StandardEntryType.Book, StandardEntryType.InBook), + Arguments.of(StandardEntryType.Book, StandardEntryType.BookInBook), + Arguments.of(StandardEntryType.Book, StandardEntryType.SuppBook), + Arguments.of(StandardEntryType.Collection, StandardEntryType.InCollection), + Arguments.of(StandardEntryType.Collection, StandardEntryType.SuppCollection), + Arguments.of(StandardEntryType.Reference, StandardEntryType.InReference), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings) + ); + } + + + @ParameterizedTest + @MethodSource("sameNameInheritance") + void sameNameInheritance(EntryType parentType, EntryType childType, StandardField field) { + parent.setType(parentType); + child.setType(childType); + + assertTrue(parent.setField(field, "parent_FIELD").isPresent()); + + assertEquals( + parent.getResolvedFieldOrAlias(field, null), + child.getResolvedFieldOrAlias(field, db) + ); + } - assertNotEquals( - source.getResolvedFieldOrAlias(StandardField.TITLE, database), - target.getResolvedFieldOrAlias(StandardField.BOOKTITLE, database) + private static Stream sameNameInheritance() { + return Stream.of( + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ABSTRACT), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ADDENDUM), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ADDRESS), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.AFTERWORD), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ANNOTE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ANNOTATION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ANNOTATOR), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ARCHIVEPREFIX), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ASSIGNEE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.AUTHOR), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKAUTHOR), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKPAGINATION), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKSUBTITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKTITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKTITLEADDON), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.CHAPTER), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.COMMENTATOR), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.COMMENT), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.CROSSREF), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.DATE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.DAY), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.DAYFILED), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.DOI), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITOR), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORA), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORB), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORC), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORTYPE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORATYPE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORBTYPE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORCTYPE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EID), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ENTRYSET), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EPRINT), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EPRINTCLASS), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EPRINTTYPE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EVENTDATE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EVENTTITLE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EVENTTITLEADDON), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.FILE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.FOREWORD), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.FOLDER), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.GENDER), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.HOLDER), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.HOWPUBLISHED), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.IDS), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.INSTITUTION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.INTRODUCTION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISBN), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISRN), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISSN), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISSUE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISSUETITLE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISSUESUBTITLE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.JOURNAL), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.JOURNALSUBTITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.JOURNALTITLE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.KEY), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.KEYWORDS), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.LANGUAGE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.LOCATION), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MAINSUBTITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MAINTITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MAINTITLEADDON), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MONTH), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MONTHFILED), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.NAMEADDON), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.NATIONALITY), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.NOTE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.NUMBER), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ORGANIZATION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ORIGDATE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ORIGLANGUAGE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PAGES), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PAGETOTAL), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PAGINATION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PART), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PDF), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PMID), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PS), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PUBLISHER), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PUBSTATE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PRIMARYCLASS), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.RELATED), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.REPORTNO), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.REVIEW), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.REVISION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SCHOOL), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SERIES), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SHORTAUTHOR), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SHORTEDITOR), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SHORTTITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SORTKEY), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SORTNAME), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SUBTITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TITLE), +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TITLEADDON), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TRANSLATOR), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TYPE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.URI), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.URL), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.URLDATE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.VENUE), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.VERSION), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.VOLUME), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.VOLUMES), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.YEAR), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.YEARFILED), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MR_NUMBER), + Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.XDATA) +// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.XREF) ); } } diff --git a/src/test/resources/org/jabref/model/entry/crossref.bib b/src/test/resources/org/jabref/model/entry/crossref.bib deleted file mode 100644 index affe9946898..00000000000 --- a/src/test/resources/org/jabref/model/entry/crossref.bib +++ /dev/null @@ -1,14 +0,0 @@ -@Proceedings{pr_001, - title = {Proceedings_001}, - year = {2019}, -} - -@InProceedings{inpr_001, - crossref = {pr_001}, -} - -@InProceedings{inpr_002, - crossref = {pr_001}, - booktitle = {foobar}, - year = {42} -} From 89f7a617b74626a38ebcb121e8ce666864ce5dce Mon Sep 17 00:00:00 2001 From: Stanley F Date: Mon, 9 Sep 2019 14:22:57 +0200 Subject: [PATCH 6/7] checkstyle fix --- src/test/java/org/jabref/model/entry/CrossrefTest.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/CrossrefTest.java b/src/test/java/org/jabref/model/entry/CrossrefTest.java index 929b9d5167f..5a2fd62ae24 100644 --- a/src/test/java/org/jabref/model/entry/CrossrefTest.java +++ b/src/test/java/org/jabref/model/entry/CrossrefTest.java @@ -48,7 +48,6 @@ void setup() { db = new BibDatabase(Arrays.asList(parent, child)); } - @ParameterizedTest @EnumSource(value = StandardField.class, names = {"IDS", "XREF", "ENTRYSET", "RELATED", "SORTKEY"}) void forbiddenFields(StandardField field) { @@ -84,7 +83,6 @@ private static Stream authorInheritanceSource() { ); } - @ParameterizedTest @MethodSource("mainTitleInheritanceSource") void mainTitleInheritance(EntryType parentType, EntryType childType) { @@ -121,7 +119,6 @@ private static Stream mainTitleInheritanceSource() { ); } - @ParameterizedTest @MethodSource("bookTitleInheritanceSource") void bookTitleInheritance(EntryType parentType, EntryType childType) { @@ -154,7 +151,6 @@ private static Stream bookTitleInheritanceSource() { ); } - @ParameterizedTest @MethodSource("journalTitleInheritanceSource") void journalTitleInheritance(EntryType parentType, EntryType childType) { @@ -178,7 +174,6 @@ private static Stream journalTitleInheritanceSource() { ); } - @ParameterizedTest @MethodSource("noTitleInheritanceSource") void noTitleInheritance(EntryType parentType, EntryType childType) { @@ -214,7 +209,6 @@ private static Stream noTitleInheritanceSource() { ); } - @ParameterizedTest @MethodSource("sameNameInheritance") void sameNameInheritance(EntryType parentType, EntryType childType, StandardField field) { From 3d1bf69e41afb95347aaf98745ec60c30c46a0bb Mon Sep 17 00:00:00 2001 From: Stanley F Date: Mon, 9 Sep 2019 14:28:52 +0200 Subject: [PATCH 7/7] completely remove obsolete test cases --- .../org/jabref/model/entry/CrossrefTest.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/test/java/org/jabref/model/entry/CrossrefTest.java b/src/test/java/org/jabref/model/entry/CrossrefTest.java index 5a2fd62ae24..98effbb5635 100644 --- a/src/test/java/org/jabref/model/entry/CrossrefTest.java +++ b/src/test/java/org/jabref/model/entry/CrossrefTest.java @@ -235,15 +235,10 @@ private static Stream sameNameInheritance() { Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ARCHIVEPREFIX), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ASSIGNEE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.AUTHOR), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKAUTHOR), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKPAGINATION), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKSUBTITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKTITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.BOOKTITLEADDON), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.CHAPTER), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.COMMENTATOR), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.COMMENT), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.CROSSREF), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.DATE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.DAY), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.DAYFILED), @@ -258,7 +253,6 @@ private static Stream sameNameInheritance() { Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORBTYPE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EDITORCTYPE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EID), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ENTRYSET), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EPRINT), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EPRINTCLASS), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.EPRINTTYPE), @@ -271,7 +265,6 @@ private static Stream sameNameInheritance() { Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.GENDER), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.HOLDER), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.HOWPUBLISHED), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.IDS), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.INSTITUTION), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.INTRODUCTION), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISBN), @@ -281,15 +274,10 @@ private static Stream sameNameInheritance() { Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISSUETITLE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.ISSUESUBTITLE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.JOURNAL), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.JOURNALSUBTITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.JOURNALTITLE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.KEY), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.KEYWORDS), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.LANGUAGE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.LOCATION), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MAINSUBTITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MAINTITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MAINTITLEADDON), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MONTH), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MONTHFILED), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.NAMEADDON), @@ -309,7 +297,6 @@ private static Stream sameNameInheritance() { Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PUBLISHER), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PUBSTATE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.PRIMARYCLASS), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.RELATED), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.REPORTNO), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.REVIEW), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.REVISION), @@ -317,12 +304,7 @@ private static Stream sameNameInheritance() { Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SERIES), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SHORTAUTHOR), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SHORTEDITOR), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SHORTTITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SORTKEY), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SORTNAME), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.SUBTITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TITLE), -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TITLEADDON), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TRANSLATOR), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.TYPE), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.URI), @@ -336,7 +318,6 @@ private static Stream sameNameInheritance() { Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.YEARFILED), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.MR_NUMBER), Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.XDATA) -// Arguments.of(StandardEntryType.Proceedings, StandardEntryType.InProceedings, StandardField.XREF) ); } }