Skip to content

Commit d9e8e9d

Browse files
committed
refactor(tests): use ParameterizedTest for UtilsTest.normalize
1 parent 8b1f1c0 commit d9e8e9d

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/test/java/com/abahgat/suffixtree/UtilsTest.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,24 @@
1717

1818
import java.util.Set;
1919
import org.junit.jupiter.api.Test;
20+
import org.junit.jupiter.params.ParameterizedTest;
21+
import org.junit.jupiter.params.provider.CsvSource;
2022
import static org.junit.jupiter.api.Assertions.assertEquals;
2123
import static org.junit.jupiter.api.Assertions.assertTrue;
2224

2325
import com.abahgat.suffixtree.Utils;
2426

2527
public class UtilsTest {
2628

27-
@Test
28-
public void testNormalize() {
29-
String[] ins = new String[]{"200 S Main St", "Lakeshore Dr.", "lake-view", "St. Jacob's Cathedral"};
30-
String[] outs = new String[]{"200smainst", "lakeshoredr", "lakeview", "stjacobscathedral"};
31-
32-
for (int i = 0; i < ins.length; ++i) {
33-
String result = Utils.normalize(ins[i]);
34-
assertEquals(outs[i], result);
35-
}
29+
@ParameterizedTest
30+
@CsvSource({
31+
"200 S Main St, 200smainst",
32+
"Lakeshore Dr., lakeshoredr",
33+
"lake-view, lakeview",
34+
"St. Jacob's Cathedral, stjacobscathedral"
35+
})
36+
public void testNormalize(String input, String expected) {
37+
assertEquals(expected, Utils.normalize(input));
3638
}
3739

3840
@Test

0 commit comments

Comments
 (0)