Skip to content

Commit

Permalink
Compile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Aug 28, 2023
1 parent d1c4f24 commit a0f78a4
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 31 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ dependencies {
implementation group: 'org.jooq', name: 'jool', version: '0.9.15'

compileOnly 'org.jspecify:jspecify:0.3.0'
testCompileOnly 'org.jspecify:jspecify:0.3.0'

testImplementation 'io.github.classgraph:classgraph:4.8.162'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/jabref/logic/crawler/CrawlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public void setUp() throws Exception {
importerPreferences = mock(ImporterPreferences.class);
saveConfiguration = mock(SaveConfiguration.class, Answers.RETURNS_DEEP_STUBS);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());
when(saveConfiguration.useMetadataSaveOrder()).thenReturn(true);
when(importerPreferences.getApiKeys()).thenReturn(FXCollections.emptyObservableSet());
when(importFormatPreferences.bibEntryPreferences().getKeywordSeparator()).thenReturn(',');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void setUpMocks() {
preferencesService = mock(PreferencesService.class, Answers.RETURNS_DEEP_STUBS);
saveConfiguration = mock(SaveConfiguration.class, Answers.RETURNS_DEEP_STUBS);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());
when(saveConfiguration.useMetadataSaveOrder()).thenReturn(true);
when(preferencesService.getBibEntryPreferences().getKeywordSeparator()).thenReturn(',');
when(preferencesService.getImporterPreferences().getApiKeys()).thenReturn(FXCollections.emptyObservableSet());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ public class CsvExportFormatTest {

@BeforeEach
public void setUp() {
SaveConfiguration saveConfiguration = mock(SaveConfiguration.class);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());

exportFormat = new TemplateExporter(
"OpenOffice/LibreOffice CSV",
"oocsv",
"openoffice-csv",
"openoffice",
StandardFileType.CSV,
mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS),
saveConfiguration);
SaveOrder.getDefaultSaveOrder());

databaseContext = new BibDatabaseContext();
}
Expand Down Expand Up @@ -101,8 +98,8 @@ public void testPerformExportForSingleEditor(@TempDir Path testFolder) throws Ex
public void testPerformExportForMultipleEditors(@TempDir Path testFolder) throws Exception {
Path path = testFolder.resolve("ThisIsARandomlyNamedFile");
File tmpFile = path.toFile();
BibEntry entry = new BibEntry();
entry.setField(StandardField.EDITOR, "von Neumann, John and Smith, John and Black Brown, Peter");
BibEntry entry = new BibEntry()
.withField(StandardField.EDITOR, "von Neumann, John and Smith, John and Black Brown, Peter");
List<BibEntry> entries = List.of(entry);

exportFormat.export(databaseContext, tmpFile.toPath(), entries);
Expand Down
18 changes: 7 additions & 11 deletions src/test/java/org/jabref/logic/exporter/DocBook5ExporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class DocBook5ExporterTest {

Expand All @@ -42,29 +41,26 @@ public class DocBook5ExporterTest {

@BeforeEach
void setUp() throws URISyntaxException {
SaveConfiguration saveConfiguration = mock(SaveConfiguration.class);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());

exporter = new TemplateExporter(
"DocBook 5.1",
"docbook5",
"docbook5",
null,
StandardFileType.XML,
mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS),
saveConfiguration);
SaveOrder.getDefaultSaveOrder());

LocalDate myDate = LocalDate.of(2018, 1, 1);

xmlFile = Path.of(DocBook5ExporterTest.class.getResource("Docbook5ExportFormat.xml").toURI());
databaseContext = new BibDatabaseContext();
charset = StandardCharsets.UTF_8;
BibEntry entry = new BibEntry(StandardEntryType.Book);
entry.setField(StandardField.TITLE, "my paper title");
entry.setField(StandardField.AUTHOR, "Stefan Kolb and Tobias Diez");
entry.setField(StandardField.ISBN, "1-2-34");
entry.setCitationKey("mykey");
entry.setDate(new org.jabref.model.entry.Date(myDate));
BibEntry entry = new BibEntry(StandardEntryType.Book)
.withField(StandardField.TITLE, "my paper title")
.withField(StandardField.AUTHOR, "Stefan Kolb and Tobias Diez")
.withField(StandardField.ISBN, "1-2-34")
.withCitationKey("mykey")
.withDate(new org.jabref.model.entry.Date(myDate));
entries = Collections.singletonList(entry);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@ public class DocbookExporterTest {

@BeforeEach
public void setUp() {
SaveConfiguration saveConfiguration = mock(SaveConfiguration.class);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());

exportFormat = new TemplateExporter(
"DocBook 4",
"docbook4",
"docbook4",
null,
StandardFileType.XML,
mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS),
saveConfiguration);
SaveOrder.getDefaultSaveOrder());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ public class HtmlExportFormatTest {

@BeforeEach
public void setUp() {
SaveConfiguration saveConfiguration = mock(SaveConfiguration.class);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());

exportFormat = new TemplateExporter("HTML",
"html",
"html",
null,
StandardFileType.HTML,
mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS),
saveConfiguration);
SaveOrder.getDefaultSaveOrder());

databaseContext = new BibDatabaseContext();
charset = StandardCharsets.UTF_8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ public class YamlExporterTest {

@BeforeAll
static void setUp() {
SaveConfiguration saveConfiguration = mock(SaveConfiguration.class);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());

yamlExporter = new TemplateExporter(
"CSL YAML",
"yaml",
"yaml",
null,
StandardFileType.YAML,
mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS),
saveConfiguration,
SaveOrder.getDefaultSaveOrder(),
BlankLineBehaviour.DELETE_BLANKS);

databaseContext = new BibDatabaseContext();
Expand Down

0 comments on commit a0f78a4

Please sign in to comment.