|
1 | 1 | package com.fishercoder;
|
2 | 2 |
|
3 | 3 | import com.fishercoder.solutions._784;
|
| 4 | + |
4 | 5 | import java.util.Arrays;
|
5 | 6 | import java.util.List;
|
| 7 | + |
6 | 8 | import org.junit.BeforeClass;
|
7 | 9 | import org.junit.Test;
|
8 | 10 |
|
9 |
| -import static org.junit.Assert.assertEquals; |
| 11 | +import static org.assertj.core.api.Assertions.assertThat; |
10 | 12 |
|
11 | 13 | public class _784Test {
|
12 |
| - private static _784.Solution1 solution1; |
13 |
| - private static List<String> expected; |
14 |
| - |
15 |
| - @BeforeClass |
16 |
| - public static void setup() { |
17 |
| - solution1 = new _784.Solution1(); |
18 |
| - } |
19 |
| - |
20 |
| - @Test |
21 |
| - public void test1() { |
22 |
| - expected = Arrays.asList("a1b2", "a1B2", "A1b2", "A1B2"); |
23 |
| - assertEquals(expected, solution1.letterCasePermutation("a1b2")); |
24 |
| - } |
25 |
| - |
26 |
| - @Test |
27 |
| - public void test2() { |
28 |
| - expected = Arrays.asList("3z4", "3Z4"); |
29 |
| - assertEquals(expected, solution1.letterCasePermutation("3z4")); |
30 |
| - } |
31 |
| - |
32 |
| - @Test |
33 |
| - public void test3() { |
34 |
| - expected = Arrays.asList("12345"); |
35 |
| - assertEquals(expected, solution1.letterCasePermutation("12345")); |
36 |
| - } |
| 14 | + private static _784.Solution1 solution1; |
| 15 | + private static _784.Solution2 solution2; |
| 16 | + private static List<String> expected; |
| 17 | + |
| 18 | + @BeforeClass |
| 19 | + public static void setup() { |
| 20 | + solution1 = new _784.Solution1(); |
| 21 | + solution2 = new _784.Solution2(); |
| 22 | + } |
| 23 | + |
| 24 | + @Test |
| 25 | + public void test1() { |
| 26 | + expected = Arrays.asList("a1b2", "a1B2", "A1b2", "A1B2"); |
| 27 | + assertThat(expected).hasSameElementsAs(solution1.letterCasePermutation("a1b2")); |
| 28 | + assertThat(expected).hasSameElementsAs(solution2.letterCasePermutation("a1b2")); |
| 29 | + } |
| 30 | + |
| 31 | + @Test |
| 32 | + public void test2() { |
| 33 | + expected = Arrays.asList("3z4", "3Z4"); |
| 34 | + assertThat(expected).hasSameElementsAs(solution1.letterCasePermutation("3z4")); |
| 35 | + assertThat(expected).hasSameElementsAs(solution2.letterCasePermutation("3z4")); |
| 36 | + } |
| 37 | + |
| 38 | + @Test |
| 39 | + public void test3() { |
| 40 | + expected = Arrays.asList("12345"); |
| 41 | + assertThat(expected).hasSameElementsAs(solution1.letterCasePermutation("12345")); |
| 42 | + assertThat(expected).hasSameElementsAs(solution2.letterCasePermutation("12345")); |
| 43 | + } |
37 | 44 | }
|
0 commit comments