-
-
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 integrity check for tilde accents in author names (#9097)
* Solving tilde error in author names * Fixed checkstyle and removed superfluous new test class * remove latex html conversion and rtf chart * add test to authorlist parser * parameterized tests * fix test * fix test * Convert to parameterized test * fix test and checkstyle * fix checkstyle and tests * Fixed tabstop * add changelog Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
- Loading branch information
1 parent
6c19393
commit ad9aa62
Showing
7 changed files
with
58 additions
and
83 deletions.
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
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
66 changes: 23 additions & 43 deletions
66
src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatterTest.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 |
---|---|---|
@@ -1,60 +1,40 @@ | ||
package org.jabref.logic.formatter.bibtexfields; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class HtmlToUnicodeFormatterTest { | ||
|
||
private HtmlToUnicodeFormatter formatter; | ||
|
||
private static Stream<Arguments> data() { | ||
return Stream.of( | ||
Arguments.of("abc", "abc"), | ||
Arguments.of("åäö", "åäö"), | ||
Arguments.of("í", "í"), | ||
Arguments.of("Ε", "Ε"), | ||
Arguments.of("ä", "ä"), | ||
Arguments.of("ä", "ä"), | ||
Arguments.of("ä", "ä"), | ||
Arguments.of("ñ", "ñ"), | ||
Arguments.of("aaa", "<p>aaa</p>"), | ||
Arguments.of("bread & butter", "<b>bread</b> & butter")); | ||
} | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
formatter = new HtmlToUnicodeFormatter(); | ||
} | ||
|
||
@Test | ||
public void formatWithoutHtmlCharactersReturnsSameString() { | ||
assertEquals("abc", formatter.format("abc")); | ||
} | ||
|
||
@Test | ||
public void formatMultipleHtmlCharacters() { | ||
assertEquals("åäö", formatter.format("åäö")); | ||
} | ||
|
||
@Test | ||
public void formatCombinedAccent() { | ||
assertEquals("í", formatter.format("í")); | ||
} | ||
|
||
@Test | ||
public void testBasic() { | ||
assertEquals("aaa", formatter.format("aaa")); | ||
} | ||
|
||
@Test | ||
public void testUmlauts() { | ||
assertEquals("ä", formatter.format("ä")); | ||
assertEquals("ä", formatter.format("ä")); | ||
assertEquals("ä", formatter.format("ä")); | ||
} | ||
|
||
@Test | ||
public void testGreekLetter() { | ||
assertEquals("Ε", formatter.format("Ε")); | ||
} | ||
|
||
@Test | ||
public void testHTMLRemoveTags() { | ||
assertEquals("aaa", formatter.format("<p>aaa</p>")); | ||
} | ||
|
||
@Test | ||
public void formatExample() { | ||
assertEquals("bread & butter", formatter.format(formatter.getExampleInput())); | ||
@ParameterizedTest | ||
@MethodSource("data") | ||
void testFormatterWorksCorrectly(String expected, String input) { | ||
assertEquals(expected, formatter.format(input)); | ||
} | ||
} | ||
|
||
|
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