-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathResultTest.java
More file actions
26 lines (21 loc) · 969 Bytes
/
ResultTest.java
File metadata and controls
26 lines (21 loc) · 969 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
26
package hackrank.datastruct.array.sparse;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
public class ResultTest {
@Test
public void matchingStrings_HackerRankSampleInput1_ExpectedCounts() {
List<String> strings = Arrays.asList("aba", "baba", "aba", "xzxb");
List<String> queries = Arrays.asList("aba", "xzxb", "ab");
List<Integer> counts = Result.matchingStrings(strings, queries);
assertThat(counts).hasSize(3).containsExactly(2, 1, 0);
}
@Test
public void matchingStrings_CatsAndDogsNoParrots_ExpectedCounts() {
List<String> strings = Arrays.asList("cat", "dog", "dog", "cat", "cat", "cat");
List<String> queries = Arrays.asList("dog", "parrot", "cat");
List<Integer> counts = Result.matchingStrings(strings, queries);
assertThat(counts).hasSize(3).containsExactly(2, 0, 4);
}
}