|
7 | 7 |
|
8 | 8 | import static junit.framework.Assert.assertEquals; |
9 | 9 |
|
10 | | -/** |
11 | | - * Created by fishercoder on 1/21/17. |
12 | | - */ |
13 | 10 | public class _408Test { |
14 | | - private static _408 test; |
15 | | - private static Boolean expected; |
16 | | - private static Boolean actual; |
17 | | - private static String word; |
18 | | - private static String abbr; |
19 | | - |
20 | | - @BeforeClass |
21 | | - public static void setup() { |
22 | | - test = new _408(); |
23 | | - } |
24 | | - |
25 | | - @Before |
26 | | - public void setupForEachTest() { |
27 | | - word = ""; |
28 | | - abbr = ""; |
29 | | - } |
30 | | - |
31 | | - @Test |
32 | | - public void test1() { |
33 | | - word = "internationalization"; |
34 | | - abbr = "i12iz4n"; |
35 | | - expected = true; |
36 | | - actual = test.validWordAbbreviation(word, abbr); |
37 | | - assertEquals(expected, actual); |
38 | | - |
39 | | - } |
40 | | - |
41 | | - @Test |
42 | | - public void test2() { |
43 | | - word = "apple"; |
44 | | - abbr = "a2e"; |
45 | | - expected = false; |
46 | | - actual = test.validWordAbbreviation(word, abbr); |
47 | | - assertEquals(expected, actual); |
48 | | - |
49 | | - } |
50 | | - |
51 | | - @Test |
52 | | - public void test3() { |
53 | | - word = "internationalization"; |
54 | | - abbr = "i5a11o1"; |
55 | | - expected = true; |
56 | | - actual = test.validWordAbbreviation(word, abbr); |
57 | | - assertEquals(expected, actual); |
58 | | - |
59 | | - } |
60 | | - |
61 | | - @Test |
62 | | - public void test4() { |
63 | | - word = "hi"; |
64 | | - abbr = "1"; |
65 | | - expected = false; |
66 | | - actual = test.validWordAbbreviation(word, abbr); |
67 | | - assertEquals(expected, actual); |
68 | | - } |
69 | | - |
70 | | - @Test |
71 | | - public void test5() { |
72 | | - word = "a"; |
73 | | - abbr = "1"; |
74 | | - expected = true; |
75 | | - actual = test.validWordAbbreviation(word, abbr); |
76 | | - assertEquals(expected, actual); |
77 | | - } |
78 | | - |
79 | | - @Test |
80 | | - public void test6() { |
81 | | - word = "a"; |
82 | | - abbr = "2"; |
83 | | - expected = false; |
84 | | - actual = test.validWordAbbreviation(word, abbr); |
85 | | - assertEquals(expected, actual); |
86 | | - } |
87 | | - |
88 | | - @Test |
89 | | - public void test7() { |
90 | | - word = "hi"; |
91 | | - abbr = "1i"; |
92 | | - expected = true; |
93 | | - actual = test.validWordAbbreviation(word, abbr); |
94 | | - assertEquals(expected, actual); |
95 | | - } |
96 | | - |
97 | | - @Test |
98 | | - public void test8() { |
99 | | - word = "hi"; |
100 | | - abbr = "3"; |
101 | | - expected = false; |
102 | | - actual = test.validWordAbbreviation(word, abbr); |
103 | | - assertEquals(expected, actual); |
104 | | - } |
105 | | - |
106 | | - @Test |
107 | | - public void test9() { |
108 | | - word = "hi"; |
109 | | - abbr = "11"; |
110 | | - expected = false; |
111 | | - actual = test.validWordAbbreviation(word, abbr); |
112 | | - assertEquals(expected, actual); |
113 | | - } |
114 | | - |
115 | | - @Test |
116 | | - public void test10() { |
117 | | - word = "word"; |
118 | | - abbr = "1o1d"; |
119 | | - expected = true; |
120 | | - actual = test.validWordAbbreviation(word, abbr); |
121 | | - assertEquals(expected, actual); |
122 | | - } |
123 | | - |
124 | | - @Test |
125 | | - public void test11() { |
126 | | - word = "abbreviation"; |
127 | | - abbr = "a010n"; |
128 | | - expected = false; |
129 | | - actual = test.validWordAbbreviation(word, abbr); |
130 | | - assertEquals(expected, actual); |
131 | | - } |
| 11 | + private static _408.Solution1 solution1; |
| 12 | + private static Boolean expected; |
| 13 | + private static Boolean actual; |
| 14 | + private static String word; |
| 15 | + private static String abbr; |
| 16 | + |
| 17 | + @BeforeClass |
| 18 | + public static void setup() { |
| 19 | + solution1 = new _408.Solution1(); |
| 20 | + } |
| 21 | + |
| 22 | + @Before |
| 23 | + public void setupForEachTest() { |
| 24 | + word = ""; |
| 25 | + abbr = ""; |
| 26 | + } |
| 27 | + |
| 28 | + @Test |
| 29 | + public void test1() { |
| 30 | + word = "internationalization"; |
| 31 | + abbr = "i12iz4n"; |
| 32 | + expected = true; |
| 33 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 34 | + assertEquals(expected, actual); |
| 35 | + } |
| 36 | + |
| 37 | + @Test |
| 38 | + public void test2() { |
| 39 | + word = "apple"; |
| 40 | + abbr = "a2e"; |
| 41 | + expected = false; |
| 42 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 43 | + assertEquals(expected, actual); |
| 44 | + } |
| 45 | + |
| 46 | + @Test |
| 47 | + public void test3() { |
| 48 | + word = "internationalization"; |
| 49 | + abbr = "i5a11o1"; |
| 50 | + expected = true; |
| 51 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 52 | + assertEquals(expected, actual); |
| 53 | + } |
| 54 | + |
| 55 | + @Test |
| 56 | + public void test4() { |
| 57 | + word = "hi"; |
| 58 | + abbr = "1"; |
| 59 | + expected = false; |
| 60 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 61 | + assertEquals(expected, actual); |
| 62 | + } |
| 63 | + |
| 64 | + @Test |
| 65 | + public void test5() { |
| 66 | + word = "a"; |
| 67 | + abbr = "1"; |
| 68 | + expected = true; |
| 69 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 70 | + assertEquals(expected, actual); |
| 71 | + } |
| 72 | + |
| 73 | + @Test |
| 74 | + public void test6() { |
| 75 | + word = "a"; |
| 76 | + abbr = "2"; |
| 77 | + expected = false; |
| 78 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 79 | + assertEquals(expected, actual); |
| 80 | + } |
| 81 | + |
| 82 | + @Test |
| 83 | + public void test7() { |
| 84 | + word = "hi"; |
| 85 | + abbr = "1i"; |
| 86 | + expected = true; |
| 87 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 88 | + assertEquals(expected, actual); |
| 89 | + } |
| 90 | + |
| 91 | + @Test |
| 92 | + public void test8() { |
| 93 | + word = "hi"; |
| 94 | + abbr = "3"; |
| 95 | + expected = false; |
| 96 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 97 | + assertEquals(expected, actual); |
| 98 | + } |
| 99 | + |
| 100 | + @Test |
| 101 | + public void test9() { |
| 102 | + word = "hi"; |
| 103 | + abbr = "11"; |
| 104 | + expected = false; |
| 105 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 106 | + assertEquals(expected, actual); |
| 107 | + } |
| 108 | + |
| 109 | + @Test |
| 110 | + public void test10() { |
| 111 | + word = "word"; |
| 112 | + abbr = "1o1d"; |
| 113 | + expected = true; |
| 114 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 115 | + assertEquals(expected, actual); |
| 116 | + } |
| 117 | + |
| 118 | + @Test |
| 119 | + public void test11() { |
| 120 | + word = "abbreviation"; |
| 121 | + abbr = "a010n"; |
| 122 | + expected = false; |
| 123 | + actual = solution1.validWordAbbreviation(word, abbr); |
| 124 | + assertEquals(expected, actual); |
| 125 | + } |
132 | 126 | } |
0 commit comments