Skip to content

Commit

Permalink
Fix some fetcher tests
Browse files Browse the repository at this point in the history
Signed-off-by: subhramit <subhramit.bb@live.in>
  • Loading branch information
subhramit committed Feb 14, 2025
1 parent 2178bc7 commit 9486518
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class BiodiversityLibrary implements SearchBasedParserFetcher, Customizab

private static final String BASE_URL = "https://www.biodiversitylibrary.org/api3";
private static final String RESPONSE_FORMAT = "json";
private static final String TEST_URL_WITHOUT_API_KEY = "https://www.biodiversitylibrary.org/api3?apikey=";
private static final String TEST_URL_WITHOUT_API_KEY = "https://www.biodiversitylibrary.org/api3?";

private final ImporterPreferences importerPreferences;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

@FetcherTest
class BiodiversityLibraryTest {
private final String RESPONSE_FORMAT = "&format=json";
private final String RESPONSE_FORMAT = "format=json";

private String apiKey;
private BiodiversityLibrary fetcher;
Expand Down Expand Up @@ -56,7 +56,6 @@ void biodiversityHeritageApiKeyIsNotEmpty() {
void baseURLConstruction() throws MalformedURLException, URISyntaxException {
String expected = fetcher
.getTestUrl()
.concat(apiKey)
.concat(RESPONSE_FORMAT);

assertEquals(expected, fetcher.getBaseURL().toString());
Expand All @@ -67,7 +66,6 @@ void baseURLConstruction() throws MalformedURLException, URISyntaxException {
void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxException {
String expected = fetcher
.getTestUrl()
.concat(apiKey)
.concat(RESPONSE_FORMAT)
.concat("&op=GetPartMetadata&pages=f&names=f")
.concat("&id=");
Expand All @@ -80,7 +78,6 @@ void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxExceptio
void getItemMetadaUrl(String id) throws MalformedURLException, URISyntaxException {
String expected = fetcher
.getTestUrl()
.concat(apiKey)
.concat(RESPONSE_FORMAT)
.concat("&op=GetItemMetadata&pages=f&ocr=f&ocr=f")
.concat("&id=");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static Stream<Arguments> performSearch() {
.withField(StandardField.URL, "http://library.oapen.org/handle/20.500.12657/25535")
.withField(StandardField.URI, "https://directory.doabooks.org/handle/20.500.12854/34739")
.withField(StandardField.LANGUAGE, "English")
.withField(StandardField.KEYWORDS, "poetry, love, warfare")
.withField(StandardField.KEYWORDS, "poetry, love, warfare, thema EDItEUR::D Biography, Literature and Literary studies::DC Poetry::DCF Poetry by individual poets")
.withField(StandardField.PUBLISHER, "punctum books"),
"i open fire"
),
Expand All @@ -55,8 +55,7 @@ public static Stream<Arguments> performSearch() {
.withField(StandardField.URL, "http://library.oapen.org/handle/20.500.12657/25287")
.withField(StandardField.URI, "https://directory.doabooks.org/handle/20.500.12854/26303")
.withField(StandardField.LANGUAGE, "English")
.withField(StandardField.KEYWORDS, "Open Access, Monographs, OAPEN Library, " +
"Directory of Open Access Books")
.withField(StandardField.KEYWORDS, "Open Access, Monographs, OAPEN Library, Directory of Open Access Books, thema EDItEUR::G Reference, Information and Interdisciplinary subjects::GL Library and information sciences / Museology, thema EDItEUR::G Reference, Information and Interdisciplinary subjects::GP Research and information: general")
.withField(StandardField.PUBLISHER, "Amsterdam University Press"),
"the deliverance of open access books"
),
Expand All @@ -70,7 +69,7 @@ public static Stream<Arguments> performSearch() {
.withField(StandardField.URL, "https://library.oapen.org/handle/20.500.12657/48312")
.withField(StandardField.URI, "https://directory.doabooks.org/handle/20.500.12854/68086")
.withField(StandardField.LANGUAGE, "English")
.withField(StandardField.KEYWORDS, "Religion")
.withField(StandardField.KEYWORDS, "Religion, thema EDItEUR::Q Philosophy and Religion::QR Religion and beliefs::QRM Christianity::QRMF Christianity: sacred texts and revered writings::QRMF1 Bibles::QRMF13 New Testaments")
.withField(StandardField.PUBLISHER, "Brill"),
"Four Kingdom Motifs before and beyond the Book of Daniel"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class DoiFetcherTest {
.withField(StandardField.PUBLISHER, "IEEE")
.withField(StandardField.TITLE, "BPEL4Chor: Extending BPEL for Modeling Choreographies")
.withField(StandardField.YEAR, "2007")
.withField(StandardField.PAGES, "296--303")
.withField(StandardField.DOI, "10.1109/icws.2007.59");
private final BibEntry bibEntryIannarelli2019 = new BibEntry(StandardEntryType.Article)
.withField(StandardField.AUTHOR,
Expand All @@ -54,7 +55,7 @@ class DoiFetcherTest {
.withField(StandardField.YEAR, "2019")
.withField(StandardField.DOI, "10.3303/CET1977146")
.withField(StandardField.JOURNAL, "Chemical Engineering Transactions")
.withField(StandardField.PAGES, "871-876")
.withField(StandardField.PAGES, "871876")
.withField(StandardField.VOLUME, "77");
private final BibEntry bibEntryStenzel2020 = new BibEntry(StandardEntryType.Article)
.withCitationKey("Stenzel_2020")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ void setUp() {
.withField(StandardField.ABSTRACT, "dummy")
.withField(StandardField.AUTHOR, "Ittai Abraham and Dahlia Malkhi and Kartik Nayak and Ling Ren and Alexander Spiegelman")
.withField(StandardField.DATE, "2017-11-24")
.withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Paper 2017/1118")
.withField(StandardField.NOTE, "\\url{https://eprint.iacr.org/2017/1118}")
.withField(StandardField.HOWPUBLISHED, "Cryptology {ePrint} Archive, Paper 2017/1118")
.withField(StandardField.TITLE, "Solida: A Blockchain Protocol Based on Reconfigurable Byzantine Consensus")
.withField(StandardField.URL, "https://eprint.iacr.org/2017/1118/20171124:064527")
.withField(StandardField.URL, "https://eprint.iacr.org/archive/versions/2017/1118/20171124:064527")
.withField(StandardField.VERSION, "20171124:064527")
.withField(StandardField.YEAR, "2017");

Expand All @@ -75,10 +74,9 @@ void setUp() {
.withField(StandardField.AUTHOR, "Christof Beierle and Thorsten Kranz and Gregor Leander")
.withField(StandardField.DATE, "2017-02-17")
.withField(StandardField.DOI, "10.1007/978-3-662-53018-4_23")
.withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Paper 2016/119")
.withField(StandardField.NOTE, "\\url{https://eprint.iacr.org/2016/119}")
.withField(StandardField.TITLE, "Lightweight Multiplication in GF(2^n) with Applications to MDS Matrices")
.withField(StandardField.URL, "https://eprint.iacr.org/2016/119/20170217:150415")
.withField(StandardField.HOWPUBLISHED, "Cryptology {ePrint} Archive, Paper 2016/119")
.withField(StandardField.TITLE, "Lightweight Multiplication in {GF}(2^n) with Applications to {MDS} Matrices")
.withField(StandardField.URL, "https://eprint.iacr.org/archive/versions/2016/119/20170217:150415")
.withField(StandardField.VERSION, "20170217:150415")
.withField(StandardField.YEAR, "2016");

Expand All @@ -87,10 +85,9 @@ void setUp() {
.withField(StandardField.ABSTRACT, "dummy")
.withField(StandardField.AUTHOR, "Sergi Delgado-Segura and Cristina Pérez-Solà and Guillermo Navarro-Arribas and Jordi Herrera-Joancomartí")
.withField(StandardField.DATE, "2018-01-19")
.withField(StandardField.HOWPUBLISHED, "Cryptology ePrint Archive, Paper 2017/1095")
.withField(StandardField.NOTE, "\\url{https://eprint.iacr.org/2017/1095}")
.withField(StandardField.TITLE, "Analysis of the Bitcoin UTXO set")
.withField(StandardField.URL, "https://eprint.iacr.org/2017/1095/20180119:113352")
.withField(StandardField.HOWPUBLISHED, "Cryptology {ePrint} Archive, Paper 2017/1095")
.withField(StandardField.TITLE, "Analysis of the Bitcoin {UTXO} set")
.withField(StandardField.URL, "https://eprint.iacr.org/archive/versions/2017/1095/20180119:113352")
.withField(StandardField.VERSION, "20180119:113352")
.withField(StandardField.YEAR, "2017");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private static Stream<Arguments> getDoiBibEntryPairs() {
.withField(StandardField.DOI, "10.2143/TVF.80.3.3285690")
.withField(StandardField.ISSN, "2031-8952, 2031-8952")
.withField(StandardField.JOURNAL, "Tijdschrift voor Filosofie")
.withField(StandardField.PAGES, "625-629")
.withField(StandardField.PAGES, "625629")
)),

Arguments.of("10.3303/CET1977146",
Expand All @@ -55,7 +55,7 @@ private static Stream<Arguments> getDoiBibEntryPairs() {
.withField(StandardField.YEAR, "2019")
.withField(StandardField.DOI, "10.3303/CET1977146")
.withField(StandardField.JOURNAL, "Chemical Engineering Transactions")
.withField(StandardField.PAGES, "871-876")
.withField(StandardField.PAGES, "871876")
.withField(StandardField.VOLUME, "77"))),
Arguments.of("10.1400/115378",
Optional.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ void setUp() {
.withField(StandardField.BOOKTITLE, "2009 35th Euromicro Conference on Software Engineering and Advanced Applications")
.withField(StandardField.PUBLISHER, "IEEE")
.withField(StandardField.TITLE, "BPELscript: A Simplified Script Syntax for WS-BPEL 2.0")
.withField(StandardField.VOLUME, "5331")
.withField(StandardField.YEAR, "2009")
.withField(StandardField.MONTH, "#aug#")
.withField(StandardField.PAGES, "39--46")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ public void authorsAreCorrectlyFormatted() throws Exception {
BibEntry bibEntry = new BibEntry(StandardEntryType.Book)
.withField(StandardField.TITLE, "Repository")
.withField(StandardField.SUBTITLE, "Eine Einführung")
.withField(StandardField.PUBLISHER, "De Gruyter Oldenbourg")
.withField(StandardField.PUBLISHER, "Walter de Gruyter GmbH")
.withField(StandardField.AUTHOR, "Habermann, Hans-Joachim")
.withField(StandardField.ISBN, "9783110702125")
.withField(StandardField.YEAR, "2020")
.withField(StandardField.ADDRESS, "München")
.withField(StandardField.EDITION, "Reprint 2020")
.withField(StandardField.ADDRESS, "Berlin/München/Boston")
.withField(StandardField.EDITION, "1st ed.")
.withField(StandardField.EDITOR, "Frank Leymann")
.withField(StandardField.NUMBER, "8.1")
.withField(StandardField.PAGETOTAL, "1294")
.withField(StandardField.SERIES, "Handbuch der Informatik")
.withField(new UnknownField("ppn_gvk"), "1738076555");
.withField(StandardField.NUMBER, "v.8.1")
.withField(StandardField.PAGETOTAL, "1296")
.withField(StandardField.SERIES, "Handbuch der Informatik Series")
.withField(StandardField.NOTE, "Description based on publisher supplied metadata and other sources.")
.withField(new UnknownField("ppn_gvk"), "1910493767");

Optional<BibEntry> fetchedEntry = fetcher.performSearchById("9783110702125");
assertEquals(Optional.of(bibEntry), fetchedEntry);
Expand Down

0 comments on commit 9486518

Please sign in to comment.