-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Branch Coverage Tests FieldChange.java 18% -> 94% Abbreviation.java 63% -> 88% SuggestionProviders.java 0% -> 100% * Boundary Tests FileHelper.java -> Boundary testing of an empty file CitationKeyGenerator.java -> Boundary testing of testlagepage parser for 0-00 & 1-1 HTMLCharacterChecker.java -> Null Value Boundary test * Partition Tests ParsedEntryLink.java -> Partition testing of ParsingEntryLink UpperCaseFormatter.java -> Partition testing for special characters CitationStyleCacheTest.java -> Partition testing of cache storage * Update SuggestionProvidersTest.java SPTest typo fix * CodeStyle Fixes Checkstyle passed * Update AbbreviationTest.java Adjustments for @ellieMayVelasquez feedback #7543 (review) * Applying feedback to PR addressed all comments & suggestions to test files * checkstyle fix
- Loading branch information
1 parent
97ad19b
commit 807f85e
Showing
6 changed files
with
96 additions
and
19 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/test/java/org/jabref/gui/autocompleter/SuggestionProvidersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.jabref.gui.autocompleter; | ||
|
||
import org.jabref.logic.journals.JournalAbbreviationRepository; | ||
import org.jabref.model.database.BibDatabase; | ||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.model.entry.field.Field; | ||
import org.jabref.model.entry.field.FieldFactory; | ||
import org.jabref.model.entry.field.SpecialField; | ||
import org.jabref.model.entry.field.StandardField; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.mockito.Mockito.mock; | ||
|
||
class SuggestionProvidersTest { | ||
|
||
@Test | ||
void getForFieldTest() { | ||
BibDatabase database = new BibDatabase(); | ||
JournalAbbreviationRepository abbreviationRepository = mock(JournalAbbreviationRepository.class); | ||
BibEntry entry = new BibEntry(); | ||
Field personEntryField = StandardField.AUTHOR; | ||
Field singleEntryField = StandardField.XREF; | ||
Field multipleEntryField = StandardField.XDATA; | ||
Field journalEntryField = StandardField.JOURNAL; | ||
Field publisherEntryField = StandardField.PUBLISHER; | ||
Field specialEntryField = SpecialField.PRINTED; | ||
AutoCompletePreferences autoCompletePreferences = new AutoCompletePreferences(true, AutoCompleteFirstNameMode.BOTH, AutoCompletePreferences.NameFormat.BOTH, FieldFactory.parseFieldList(personEntryField.getName() + ";" + singleEntryField.getName() + ";" + multipleEntryField.getName() + ";" + journalEntryField.getName() + ";" + publisherEntryField.getName() + ";" + specialEntryField.getName()), null); | ||
SuggestionProviders sp = new SuggestionProviders(database, abbreviationRepository, autoCompletePreferences); | ||
SuggestionProviders empty = new SuggestionProviders(); | ||
|
||
entry.setField(personEntryField, "Goethe"); | ||
entry.setField(singleEntryField, "Single"); | ||
entry.setField(multipleEntryField, "Multiple"); | ||
entry.setField(journalEntryField, "Journal"); | ||
entry.setField(publisherEntryField, "Publisher"); | ||
entry.setField(specialEntryField, "2000"); | ||
|
||
assertEquals(org.jabref.gui.autocompleter.EmptySuggestionProvider.class, empty.getForField(personEntryField).getClass()); | ||
assertEquals(org.jabref.gui.autocompleter.PersonNameSuggestionProvider.class, sp.getForField(personEntryField).getClass()); | ||
assertEquals(org.jabref.gui.autocompleter.BibEntrySuggestionProvider.class, sp.getForField(singleEntryField).getClass()); | ||
assertEquals(org.jabref.gui.autocompleter.BibEntrySuggestionProvider.class, sp.getForField(multipleEntryField).getClass()); | ||
assertEquals(org.jabref.gui.autocompleter.JournalsSuggestionProvider.class, sp.getForField(journalEntryField).getClass()); | ||
assertEquals(org.jabref.gui.autocompleter.JournalsSuggestionProvider.class, sp.getForField(publisherEntryField).getClass()); | ||
assertEquals(org.jabref.gui.autocompleter.WordSuggestionProvider.class, sp.getForField(specialEntryField).getClass()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters