-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLabTest1.java
More file actions
60 lines (47 loc) · 1.28 KB
/
Copy pathLabTest1.java
File metadata and controls
60 lines (47 loc) · 1.28 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
package labtest;
import static org.junit.Assert.*;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class LabTest1 {
StringManipulatorClass1 s1 = new StringManipulatorClass1();
@Test
public void testStringLengthWithValue(){
assertEquals(4,s1.calculateStringLength("Fima"));
}
@Test
public void testStringLengthWithSpace(){
assertEquals(0,s1.calculateStringLength(""));
}
@Test
public void testReverseString(){
assertEquals("abba",s1.reverseString("abba"));
}
@Test
public void testReverseStringWithSpace(){
assertEquals(" ",s1.reverseString(" "));
}
@Test
public void testReverseStringWithSpecial(){
assertEquals("#*#*#",s1.reverseString("#*#*#"));
}
@Test
public void testToLowerCase(){
assertEquals("be positive",s1.toLowerCase("Be Positive"));
}
@Test
public void testToLowerCaseSpecial(){
assertEquals("be positive#*%",s1.toLowerCase("Be Positive#*%"));
}
@Test
public void testToLowerCaseSpace(){
assertEquals(" ",s1.toLowerCase(" "));
}
@Test
public void testCountOccurrences(){
assertEquals(2,s1.countOccurrences("Bangladesh",'a'));
}
@Test
public void testCountOccurrencesZero(){
assertEquals(0,s1.countOccurrences("Bangladesh",'i'));
}
}