-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidAnagramTest.java
More file actions
25 lines (23 loc) · 894 Bytes
/
Copy pathValidAnagramTest.java
File metadata and controls
25 lines (23 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import org.example.problems.valid_anagram.Solution;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
public class ValidAnagramTest {
private static Stream<Arguments> provideCases() {
return Stream.of(
Arguments.of("anagram", "nagaram", true),
Arguments.of("nagaram", "anagram", true),
Arguments.of("rat", "car", false),
Arguments.of("ratt", "raat", false),
Arguments.of("", "", true)
);
}
@ParameterizedTest
@MethodSource("provideCases")
public void test(String s, String t, boolean expected) {
Solution solution = new Solution();
Assertions.assertSame(expected, solution.isAnagram(s, t));
}
}