forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_482Test.java
63 lines (54 loc) · 1.33 KB
/
_482Test.java
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.fishercoder;
import com.fishercoder.solutions._482;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class _482Test {
private static _482 test;
private static String expected;
private static String actual;
private static String S;
private static int k;
@BeforeClass
public static void setup(){
test = new _482();
}
@Before
public void setupForEachTest(){
expected = "";
actual = "";
}
@Test
public void test1(){
S = "2-4A0r7-4k";
k = 4;
expected = "24A0-R74K";
actual = test.licenseKeyFormatting(S, k);
assertEquals(expected, actual);
}
@Test
public void test2(){
S = "2-4A0r7-4k";
k = 3;
expected = "24-A0R-74K";
actual = test.licenseKeyFormatting(S, k);
assertEquals(expected, actual);
}
@Test
public void test3(){
S = "--a-a-a-a--";
k = 2;
expected = "AA-AA";
actual = test.licenseKeyFormatting(S, k);
assertEquals(expected, actual);
}
@Test
public void test4(){
S = "---";
k = 3;
expected = "";
actual = test.licenseKeyFormatting(S, k);
assertEquals(expected, actual);
}
}