forked from task032015/stringProblem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestFirstStringProblem.java
More file actions
67 lines (53 loc) · 1.35 KB
/
Copy pathTestFirstStringProblem.java
File metadata and controls
67 lines (53 loc) · 1.35 KB
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
64
65
66
67
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestFirstStringProblem {
StringProblem sp = new StringProblem();
/*
* Postitive test case
*/
@Test
public void testFirstStringProblemPositive(){
String s = sp.removeCharFromStringMethod("stringProblem", 'r');
Assert.assertEquals(s, "stingPoblem");
}
/*
* negative test cases 1: String equals empty
*/
@Test
public void testFirstStringProblemWithEmpty(){
String s = sp.removeCharFromStringIterate("", 'a');
Assert.assertEquals(s, "");
}
/*
* negative test cases 2: String equals null
*/
@Test
public void testFirstStringProblemWithNull(){
String s = sp.removeCharFromStringIterate(null, 'a');
Assert.assertEquals(s, null);
}
/*
* negative test cases 3: String equals null
*/
@Test
public void testFirstStringProblemWithNullChar(){
String s = sp.removeCharFromStringIterate(null, null);
Assert.assertEquals(s, null);
}
/*
* negative test cases 4: String equals null
*/
@Test
public void testFirstStringProblemWithNullChar2(){
String s = sp.removeCharFromStringIterate("abc", null);
Assert.assertEquals(s, "abc");
}
/*
* negative test cases 5
*/
@Test
public void testFirstStringProblemWithSpecialChar(){
String s = sp.removeCharFromStringIterate("stringProblem", '$');
Assert.assertEquals(s, "stringProblem");
}
}