-
-
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.
Fix #4115: Don't report journal name as abbreviated when full name = …
…abbreviated name (#4116)
- Loading branch information
1 parent
70e9734
commit be1117a
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
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
35 changes: 35 additions & 0 deletions
35
src/test/java/org/jabref/logic/integrity/AbbreviationCheckerTest.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,35 @@ | ||
package org.jabref.logic.integrity; | ||
|
||
import java.util.Optional; | ||
|
||
import org.jabref.logic.journals.Abbreviation; | ||
import org.jabref.logic.journals.JournalAbbreviationRepository; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
|
||
class AbbreviationCheckerTest { | ||
|
||
private JournalAbbreviationRepository abbreviationRepository; | ||
private AbbreviationChecker checker; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
abbreviationRepository = new JournalAbbreviationRepository(new Abbreviation("Test Journal", "T. J.")); | ||
checker = new AbbreviationChecker(abbreviationRepository); | ||
} | ||
|
||
@Test | ||
void checkValueComplainsAboutAbbreviatedJournalName() { | ||
assertNotEquals(Optional.empty(), checker.checkValue("T. J.")); | ||
} | ||
|
||
@Test | ||
void checkValueDoesNotComplainAboutJournalNameThatHasSameAbbreviation() { | ||
abbreviationRepository.addEntry(new Abbreviation("Journal", "Journal")); | ||
assertEquals(Optional.empty(), checker.checkValue("Journal")); | ||
} | ||
} |