-
-
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.
- Loading branch information
1 parent
d190268
commit 753d1ee
Showing
8 changed files
with
237 additions
and
3 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
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
30 changes: 30 additions & 0 deletions
30
src/test/java/org/jabref/logic/util/strings/StringSimilarityTest.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,30 @@ | ||
package org.jabref.logic.util.strings; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class StringSimilarityTest { | ||
|
||
private StringSimilarity similarityChecker = new StringSimilarity(); | ||
|
||
@ParameterizedTest(name = "a={0}, b={1}, result={2}") | ||
@CsvSource({ | ||
"'', '', true", // same empty strings | ||
"a, a, true", // same one-letter strings | ||
"a, '', true", // one string is empty and similarity < threshold (4) | ||
"'', a, true", // one string is empty and similarity < threshold (4) | ||
"abcd, '', true", // one string is empty and similarity == threshold (4) | ||
"'', abcd, true", // one string is empty and similarity == threshold (4) | ||
"abcde, '', false", // one string is empty and similarity > threshold (4) | ||
"'', abcde, false", // one string is empty and similarity > threshold (4) | ||
"abcdef, abcdef, true", // same multi-letter strings | ||
"abcdef, abc, true", // no empty strings and similarity < threshold (4) | ||
"abcdef, ab, true", // no empty strings and similarity == threshold (4) | ||
"abcdef, a, false" // no empty string sand similarity > threshold (4) | ||
}) | ||
public void testStringSimilarity(String a, String b, String expectedResult) { | ||
assertEquals(Boolean.valueOf(expectedResult), similarityChecker.isSimilar(a, b)); | ||
} | ||
} |