Skip to content

Commit 622df23

Browse files
author
TheRealHaui
committed
Added tests
1 parent 21a1608 commit 622df23

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ void testApplyWithNullSimilarityInput() {
4545
() -> new LevenshteinDetailedDistance(0).apply(new SimilarityCharacterInput("asdf"), (SimilarityCharacterInput) null));
4646
assertThrows(IllegalArgumentException.class,
4747
() -> new LevenshteinDetailedDistance(0).apply((SimilarityCharacterInput) null, new SimilarityCharacterInput("asdf")));
48+
assertThrows(IllegalArgumentException.class,
49+
() -> new LevenshteinDetailedDistance(null).apply(new SimilarityCharacterInput("asdf"), (SimilarityCharacterInput) null));
50+
assertThrows(IllegalArgumentException.class,
51+
() -> new LevenshteinDetailedDistance(null).apply((SimilarityCharacterInput) null, new SimilarityCharacterInput("asdf")));
4852
}
4953

5054
@Test

src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static org.junit.jupiter.api.Assertions.assertEquals;
2020
import static org.junit.jupiter.api.Assertions.assertThrows;
21+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
2122

2223
import org.junit.jupiter.api.BeforeAll;
2324
import org.junit.jupiter.api.Test;
@@ -133,4 +134,10 @@ void testLongestCommonSubsequenceApply() {
133134
assertEquals(4, subject.apply("leettteft", "ritttght"));
134135
assertEquals(15, subject.apply("the same string", "the same string"));
135136
}
137+
138+
@Test
139+
void testLongestCommonSubstringLengthArray() {
140+
assertArrayEquals(new int[][]{ {0, 0, 0, 0}, {0, 1, 1, 1}, {0, 1, 2, 2}}, subject.longestCommonSubstringLengthArray("ab", "abc"));
141+
}
142+
136143
}

0 commit comments

Comments
 (0)