From deb3c0e5ebc312048265d7c4f7738b11a52c1af1 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 7 Jul 2020 14:06:49 +0200 Subject: [PATCH] Use builder instead of "setField" statements --- .../importer/fetcher/INSPIREFetcherTest.java | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java index 82d7da1ba01..6ab918efacf 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java @@ -32,40 +32,34 @@ void setUp() { @Test void searchByQueryFindsEntry() throws Exception { - - BibEntry master = new BibEntry(StandardEntryType.MastersThesis); - master.setCiteKey("Diez:2014ppa"); - master.setField(StandardField.AUTHOR, "Diez, Tobias"); - master.setField(StandardField.TITLE, "Slice theorem for Fr\\'echet group actions and covariant symplectic field theory"); - master.setField(StandardField.SCHOOL, "Leipzig U."); - master.setField(StandardField.YEAR, "2013"); - master.setField(StandardField.EPRINT, "1405.2249"); - master.setField(StandardField.ARCHIVEPREFIX, "arXiv"); - master.setField(StandardField.PRIMARYCLASS, "math-ph"); - + BibEntry master = new BibEntry(StandardEntryType.MastersThesis) + .withCiteKey("Diez:2014ppa") + .withField(StandardField.AUTHOR, "Diez, Tobias") + .withField(StandardField.TITLE, "Slice theorem for Fr\\'echet group actions and covariant symplectic field theory") + .withField(StandardField.SCHOOL, "Leipzig U.") + .withField(StandardField.YEAR, "2013") + .withField(StandardField.EPRINT, "1405.2249") + .withField(StandardField.ARCHIVEPREFIX, "arXiv") + .withField(StandardField.PRIMARYCLASS, "math-ph"); List fetchedEntries = fetcher.performSearch("Fr\\'echet group actions field"); - assertEquals(Collections.singletonList(master), fetchedEntries); } @Test public void searchByIdentifierFindsEntry() throws Exception { - BibEntry article = new BibEntry(StandardEntryType.Article); - article.setCiteKey("Melnikov:1998pr"); - article.setField(StandardField.AUTHOR, "Melnikov, Kirill and Yelkhovsky, Alexander"); - article.setField(StandardField.TITLE, "Top quark production at threshold with O(alpha-s**2) accuracy"); - article.setField(StandardField.DOI, "10.1016/S0550-3213(98)00348-4"); - article.setField(StandardField.JOURNAL, "Nucl. Phys. B"); - article.setField(StandardField.PAGES, "59--72"); - article.setField(StandardField.VOLUME, "528"); - article.setField(StandardField.YEAR, "1998"); - article.setField(StandardField.EPRINT, "hep-ph/9802379"); - article.setField(StandardField.ARCHIVEPREFIX, "arXiv"); - article.setField(new UnknownField("reportnumber"), "BUDKER-INP-1998-7, TTP-98-10"); - + BibEntry article = new BibEntry(StandardEntryType.Article) + .withCiteKey("Melnikov:1998pr") + .withField(StandardField.AUTHOR, "Melnikov, Kirill and Yelkhovsky, Alexander") + .withField(StandardField.TITLE, "Top quark production at threshold with O(alpha-s**2) accuracy") + .withField(StandardField.DOI, "10.1016/S0550-3213(98)00348-4") + .withField(StandardField.JOURNAL, "Nucl. Phys. B") + .withField(StandardField.PAGES, "59--72") + .withField(StandardField.VOLUME, "528") + .withField(StandardField.YEAR, "1998") + .withField(StandardField.EPRINT, "hep-ph/9802379") + .withField(StandardField.ARCHIVEPREFIX, "arXiv") + .withField(new UnknownField("reportnumber"), "BUDKER-INP-1998-7, TTP-98-10"); List fetchedEntries = fetcher.performSearch("hep-ph/9802379"); - assertEquals(Collections.singletonList(article), fetchedEntries); - } }