Skip to content

Commit

Permalink
fix tests and checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr committed Nov 4, 2023
1 parent 798d723 commit a13e3c8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/fieldeditors/ISSNEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void requestFocus() {
private void fetchInformationByIdentifier() {
entry.ifPresent(viewModel::fetchBibliographyInformation);
}

@FXML
private void showJournalInfo() {
if (JournalInfoOptInDialogHelper.isJournalInfoEnabled(dialogService, preferencesService.getEntryEditorPreferences())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public List<BibEntry> performSearch(BibEntry entry) throws FetcherException {
Optional<String> issn = entry.getField(StandardField.ISSN);
if (issn.isPresent()) {
Optional<JournalInformation> journalInformation = journalInformationFetcher.getJournalInformation(issn.get(), "");
return journalInformation.map(journalInfo -> journalInformationToBibEntry(journalInfo, issn.get()) ).stream().toList();
return journalInformation.map(journalInfo -> journalInformationToBibEntry(journalInfo, issn.get())).stream().toList();
}
return Collections.emptyList();
}
Expand All @@ -46,7 +46,7 @@ public Optional<BibEntry> performSearchById(String identifier) throws FetcherExc
return journalInformation.map(journalInfo -> journalInformationToBibEntry(journalInfo, identifier));
}

private BibEntry journalInformationToBibEntry(JournalInformation journalInfo, String issn){
private BibEntry journalInformationToBibEntry(JournalInformation journalInfo, String issn) {
return new BibEntry().withField(StandardField.JOURNALTITLE, journalInfo.title()).withField(StandardField.PUBLISHER, journalInfo.publisher()).withField(StandardField.ISSN, issn);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/integrity/ISSNChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public Optional<String> checkValue(String value) {
if (!issn.isValidChecksum()) {
return Optional.of(Localization.lang("incorrect control digit"));
}
return Optional.of(issnString);
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class IssnFetcherTest {

private IssnFetcher fetcher;
private BibEntry bibEntry;

@BeforeEach
void setUp() {
ImportFormatPreferences importPrefs = mock(ImportFormatPreferences.class);
Expand All @@ -41,6 +42,7 @@ void performSearchByEntry() throws FetcherException {
List<BibEntry> fetchedEntry = fetcher.performSearch(bibEntry);
assertEquals(List.of(bibEntry), fetchedEntry);
}

@Test
void performSearchById() throws FetcherException {
Optional<BibEntry> fetchedEntry = fetcher.performSearchById("15454509");
Expand Down

0 comments on commit a13e3c8

Please sign in to comment.