forked from task032015/stringProblem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringTest.java
More file actions
94 lines (45 loc) · 2.1 KB
/
Copy pathStringTest.java
File metadata and controls
94 lines (45 loc) · 2.1 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package testing;
import org.testng.Assert;
import org.testng.annotations.Test;
import stringProblem.StringProblem;
public class StringTest {
private StringProblem testObject = new StringProblem();
private String expectedString;
@Test(description="to test iterative method")
public void testIterateAndRemoveChar() {
expectedString = testObject.iterateAndRemoveChar("this is a test string", 't');
Assert.assertEquals("his is a es sring",expectedString);
}
@Test(description="to test default String method")
public void testOneLineRemoveCharMethod() {
expectedString = testObject.oneLineRemoveChar("this is a test string", 's');
Assert.assertEquals("thi i a tet tring",expectedString);
}
@Test(description="to test iterative method for EmptySpace")
public void testIterateAndRemoveChar_EmptySpacePassed()
{
expectedString = testObject.iterateAndRemoveChar("this is a test string", ' ');
Assert.assertEquals("thisisateststring",expectedString);
}
@Test(description="to test iterative method for EmptySpace")
public void testOneLineRemoveCharMethod_EmptySpacePassed()
{
expectedString = testObject.oneLineRemoveChar("this is a test string", ' ');
Assert.assertEquals("thisisateststring",expectedString);
}
@Test(description="to test iterative method for special character")
public void testIterateAndRemoveChar_SpecialCharacter() {
expectedString = testObject.iterateAndRemoveChar("this is a te$t $tring", '$');
Assert.assertEquals("this is a tet tring",expectedString);
}
@Test(description="to test oneLine method for special character")
public void testOneLineRemoveCharMethod_SpecialCharacter() {
expectedString = testObject.oneLineRemoveChar("this is a te$t $tring", '$');
Assert.assertEquals("this is a tet tring",expectedString);
}
@Test(description="to test iterative method for null")
public void testIterateAndRemoveChar_Null() {
expectedString = testObject.iterateAndRemoveChar(null, 't');
Assert.assertEquals("this is a tet tring",expectedString);
}
}