-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathSolutionTest028.java
52 lines (43 loc) · 1.45 KB
/
SolutionTest028.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
//test use MCC cover
package com.blankj.easy._028;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class SolutionTest {
Solution solution = new Solution();
@Test
public void TestImplementStrWithNeedleIsPartOfHayStack(){
Integer actual = solution.strStr("1,2,3,4", "1,2");
Integer expected = 0;
assertEquals(actual, expected);
}
@Test
public void TestImplementStrWithNeedleIsNotPartOfHayStack1(){
Integer actual = solution.strStr("1,2,3,4", "2,1");
Integer expected = -1;
assertEquals(actual, expected);
}
@Test
public void TestImplementStrWithNeedleIsNone(){
Integer actual = solution.strStr("1,2,3,4", "");
Integer expected = 0;
assertEquals(actual, expected);
}
@Test
public void TestImplementStrWithLenNeedleGreaterThanLenHayStack(){
Integer actual = solution.strStr("1,2,3,4", "1,2,3,4,5");
Integer expected = -1;
assertEquals(actual, expected);
}
@Test
public void TestImplementStrWithLenNeedleEqualToLenHayStack(){
Integer actual = solution.strStr("1,2,3,4", "1,2,3,4");
Integer expected = 0;
assertEquals(actual, expected);
}
@Test
public void TestImplementStrWithNeedleIsNotPartOfHayStack2(){
Integer actual = solution.strStr("1,2,3,4", "3,4,5");
Integer expected = -1;
assertEquals(actual, expected);
}
}