Skip to content

Commit

Permalink
Streamline test code
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Sep 29, 2024
1 parent d4e933a commit 759b1d7
Showing 1 changed file with 24 additions and 38 deletions.
62 changes: 24 additions & 38 deletions src/test/java/org/jabref/logic/importer/fetcher/BvbFetcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
import org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.jabref.logic.importer.fetcher.transformers.AbstractQueryTransformer.NO_EXPLICIT_FIELD;
Expand All @@ -23,8 +22,30 @@
class BvbFetcherTest {

BvbFetcher fetcher = new BvbFetcher();
BibEntry bibEntryISBN0134685997;
BibEntry bibEntryISBN9783960886402;
BibEntry bibEntryISBN9783960886402 = new BibEntry(StandardEntryType.Misc)
.withField(StandardField.TITLE, "Effective Java")
.withField(StandardField.YEAR, "2018")
.withField(StandardField.SUBTITLE, "best practices für die Java-Plattform")
.withField(StandardField.AUTHOR, "Bloch, Joshua")
.withField(StandardField.TITLEADDON, "Joshua Bloch")
.withField(StandardField.EDITION, "3. Auflage, Übersetzung der englischsprachigen 3. Originalausgabe 2018")
.withField(StandardField.FILE, "ParsedFileField{description='', link='http://search.ebscohost.com/login.aspx?direct=true&scope=site&db=nlebk&db=nlabk&AN=1906353', fileType='PDF'}")
.withField(StandardField.ISBN, "9783960886402")
.withField(StandardField.KEYWORDS, "Klassen, Interfaces, Generics, Enums, Annotationen, Lambdas, Streams, Module, parallel, Parallele Programmierung, Serialisierung, funktional, funktionale Programmierung, Java EE, Jakarta EE")
.withField(StandardField.ADDRESS, "Heidelberg")
.withField(StandardField.PAGETOTAL, "396")
.withField(StandardField.PUBLISHER, "{dpunkt.verlag} and {Dpunkt. Verlag (Heidelberg)}");

BibEntry bibEntryISBN0134685997 = new BibEntry(StandardEntryType.Misc)
.withField(StandardField.TITLE, "Effective Java")
.withField(StandardField.YEAR, "2018")
.withField(StandardField.AUTHOR, "Bloch, Joshua")
.withField(StandardField.TITLEADDON, "Joshua Bloch")
.withField(StandardField.EDITION, "Third edition")
.withField(StandardField.ISBN, "0134685997")
.withField(StandardField.PAGETOTAL, "392")
.withField(StandardField.ADDRESS, "Boston")
.withField(StandardField.PUBLISHER, "{Addison-Wesley}");

@Test
void performTest() throws Exception {
Expand All @@ -38,41 +59,6 @@ void performTest() throws Exception {
// result.forEach(entry -> System.out.println(entry.toString()));
}

@BeforeEach
void setUp() {
fetcher = new BvbFetcher();

bibEntryISBN9783960886402 = new BibEntry(StandardEntryType.Misc)
.withField(StandardField.TITLE, "Effective Java")
.withField(StandardField.YEAR, "2018")
.withField(StandardField.SUBTITLE, "best practices für die Java-Plattform")
.withField(StandardField.AUTHOR, "Bloch, Joshua")
.withField(StandardField.TITLEADDON, "Joshua Bloch")
.withField(StandardField.EDITION, "3. Auflage, Übersetzung der englischsprachigen 3. Originalausgabe 2018")
.withField(StandardField.FILE, "ParsedFileField{description='', link='http://search.ebscohost.com/login.aspx?direct=true&scope=site&db=nlebk&db=nlabk&AN=1906353', fileType='PDF'}")
.withField(StandardField.ISBN, "9783960886402")
.withField(StandardField.KEYWORDS, "Klassen, Interfaces, Generics, Enums, Annotationen, Lambdas, Streams, Module, parallel, Parallele Programmierung, Serialisierung, funktional, funktionale Programmierung, Java EE, Jakarta EE")
.withField(StandardField.ADDRESS, "Heidelberg")
.withField(StandardField.PAGETOTAL, "396")
.withField(StandardField.PUBLISHER, "{dpunkt.verlag} and {Dpunkt. Verlag (Heidelberg)}");

bibEntryISBN0134685997 = new BibEntry(StandardEntryType.Misc)
.withField(StandardField.TITLE, "Effective Java")
.withField(StandardField.YEAR, "2018")
.withField(StandardField.AUTHOR, "Bloch, Joshua")
.withField(StandardField.TITLEADDON, "Joshua Bloch")
.withField(StandardField.EDITION, "Third edition")
.withField(StandardField.ISBN, "0134685997")
.withField(StandardField.PAGETOTAL, "392")
.withField(StandardField.ADDRESS, "Boston")
.withField(StandardField.PUBLISHER, "{Addison-Wesley}");
}

@Test
void getName() {
assertEquals("Bibliotheksverbund Bayern (Experimental)", fetcher.getName());
}

@Test
void simpleSearchQueryURLCorrect() throws Exception {
String query = "java jdk";
Expand Down

0 comments on commit 759b1d7

Please sign in to comment.