forked from task032015/stringProblem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringProblem1Test.java
More file actions
58 lines (46 loc) · 2.19 KB
/
Copy pathstringProblem1Test.java
File metadata and controls
58 lines (46 loc) · 2.19 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
/**
*
*/
package stringProblem;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* @author ssubrama
*
*/
public class stringProblem1Test {
stringProblem1 myStringProblem1Obj = null;
@Before
public void setUp() throws Exception {
myStringProblem1Obj = new stringProblem1();
}
/**
* @throws java.lang.Exception
*/
/**
* Test method for {@link stringProblem.stringProblem1#replaceChar(java.lang.String, java.lang.Character)}.
*/
@Test
public void testReplaceChar() {
assertEquals("Verifying the character is removed","ABCDEFGHIJKLMNOPQRSTUVWY", myStringProblem1Obj.replaceChar("ABCDEFGHIJKLMNOPQRSTUVWXYX",'X'));
assertEquals("Verifying that the string or character is not null","String to be tested or character cannot be null", myStringProblem1Obj.replaceChar(null,'X'));
assertEquals("Verifying that the string or character is not null","String to be tested or character cannot be null", myStringProblem1Obj.replaceChar("ABCDEFGHIJKLMNOPQRSTUVWXYX",null));
assertEquals("Verifying the character is removed from the beginning of the string","ABCDEFGHIJKLMNOPQRSTUVWY", myStringProblem1Obj.replaceChar("XABCDEFGHIJKLMNOPQRSTUVWXYX",'X'));
}
/**
* Test method for {@link stringProblem.stringProblem1#deleteChar(java.lang.String, java.lang.Character)}.
*/
@Test
public void testDeleteChar() {
String myResultString = myStringProblem1Obj.deleteChar("xabcdefghijklmnopqrstuvxxyzx",'x');
String myExpectedString = "