Skip to content

Commit

Permalink
Use builder instead of "setField" statements
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Jul 7, 2020
1 parent d6244d7 commit deb3c0e
Showing 1 changed file with 21 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<BibEntry> 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<BibEntry> fetchedEntries = fetcher.performSearch("hep-ph/9802379");

assertEquals(Collections.singletonList(article), fetchedEntries);

}
}

0 comments on commit deb3c0e

Please sign in to comment.