diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java index 0fb47acf98e..8e577b44593 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java @@ -29,6 +29,11 @@ void extractURLFormLink() { formatter.format("away.php?to=http%3A%2F%2Fwikipedia.org&a=snippet")); } + @Test + void validUrlUnmodified() { + assertEquals("http://wikipedia.org", formatter.format("http://wikipedia.org")); + } + @Test void latexCommandsNotRemoved() { assertEquals("http://pi.informatik.uni-siegen.de/stt/36\\_2/./03\\_Technische\\_Beitraege/ZEUS2016/beitrag\\_2.pdf", formatter.format("http://pi.informatik.uni-siegen.de/stt/36\\_2/./03\\_Technische\\_Beitraege/ZEUS2016/beitrag\\_2.pdf")); diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java index 86a65ceef0e..0c24c3a2dfe 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java @@ -20,6 +20,11 @@ public void removeHyphensBeforeNewlines() { assertEquals("water", formatter.format("wa-\rter")); } + @Test + public void withoutHyphensUnmodified() { + assertEquals("water", formatter.format("water")); + } + @Test public void removeHyphensBeforePlatformSpecificNewlines() { String newLine = String.format("%n"); diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java index 6bbc60e0154..f3a887838fe 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java @@ -30,6 +30,11 @@ public void removeLineFeed() { assertEquals("n linebreak", formatter.format("n\nlinebreak")); } + @Test + public void withoutNewLineUnmodified() { + assertEquals("no linebreak", formatter.format("no linebreak")); + } + @Test public void removePlatformSpecificNewLine() { String newLine = String.format("%n"); diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java index 0629e48a3fe..55eb22e6451 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java @@ -1,7 +1,12 @@ package org.jabref.logic.formatter.casechanger; +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; @@ -17,11 +22,19 @@ public void setUp() { formatter = new LowerCaseFormatter(); } - @Test - public void test() { - assertEquals("lower", formatter.format("LOWER")); - assertEquals("lower {UPPER}", formatter.format("LOWER {UPPER}")); - assertEquals("lower {U}pper", formatter.format("LOWER {U}PPER")); + @ParameterizedTest + @MethodSource("provideStringsForFormat") + public void test(String expected, String input) { + assertEquals(expected, formatter.format(input)); + } + + private static Stream provideStringsForFormat() { + return Stream.of( + Arguments.of("lower", "lower"), + Arguments.of("lower", "LOWER"), + Arguments.of("lower {UPPER}", "LOWER {UPPER}"), + Arguments.of("lower {U}pper", "LOWER {U}PPER") + ); } @Test diff --git a/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java b/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java index 018d5354786..000cc393d32 100644 --- a/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java @@ -34,4 +34,9 @@ public void singleClosingBraceCorrectlyRemoved() throws Exception { public void bracePairWithEscapedBackslashCorrectlyRemoved() throws Exception { assertEquals("\\some text\\", formatter.format("\\{some text\\}")); } + + @Test + public void withoutBracketsUnmodified() throws Exception { + assertEquals("some text", formatter.format("some text")); + } }