|
@@ -0,0 +1,120 @@
|
|
1
|
+package io.zipcoder;
|
|
2
|
+
|
|
3
|
+import org.junit.Assert;
|
|
4
|
+import org.junit.Before;
|
|
5
|
+import org.junit.Test;
|
|
6
|
+
|
|
7
|
+public class StringsAndThingsTest {
|
|
8
|
+
|
|
9
|
+ private StringsAndThings stringsAndThings;
|
|
10
|
+
|
|
11
|
+ @Before
|
|
12
|
+ public void setup(){
|
|
13
|
+ stringsAndThings = new StringsAndThings();
|
|
14
|
+ }
|
|
15
|
+
|
|
16
|
+ @Test
|
|
17
|
+ public void countYZTest1(){
|
|
18
|
+ String input = "fez day";
|
|
19
|
+ Integer expected = 2;
|
|
20
|
+ Integer actual = stringsAndThings.countYZ(input);
|
|
21
|
+ Assert.assertEquals(expected, actual);
|
|
22
|
+ }
|
|
23
|
+
|
|
24
|
+ @Test
|
|
25
|
+ public void countYZTest2(){
|
|
26
|
+ String input = "day fez";
|
|
27
|
+ Integer expected = 2;
|
|
28
|
+ Integer actual = stringsAndThings.countYZ(input);
|
|
29
|
+ Assert.assertEquals(expected, actual);
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+ @Test
|
|
34
|
+ public void countYZTest3 (){
|
|
35
|
+ String input = "day fyyyz";
|
|
36
|
+ Integer expected = 2;
|
|
37
|
+ Integer actual = stringsAndThings.countYZ(input);
|
|
38
|
+ Assert.assertEquals(expected, actual);
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ @Test
|
|
42
|
+ public void withoutStringTest1(){
|
|
43
|
+ String expected = "He there";
|
|
44
|
+ String actual = stringsAndThings.withoutString("Hello there", "llo");
|
|
45
|
+ Assert.assertEquals(expected, actual);
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ @Test
|
|
49
|
+ public void withoutStringTest2(){
|
|
50
|
+ String expected = "Hllo thr";
|
|
51
|
+ String actual = stringsAndThings.withoutString("Hello there", "e");
|
|
52
|
+ Assert.assertEquals(expected, actual);
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ @Test
|
|
56
|
+ public void withoutStringTest3(){
|
|
57
|
+ String expected = "Hello there";
|
|
58
|
+ String actual = stringsAndThings.withoutString("Hello there", "x");
|
|
59
|
+ Assert.assertEquals(expected, actual);
|
|
60
|
+ }
|
|
61
|
+
|
|
62
|
+ @Test
|
|
63
|
+ public void equalIsNotTest1(){
|
|
64
|
+ Boolean actual = stringsAndThings.equalIsNot("This is not");
|
|
65
|
+ Assert.assertFalse(actual);
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ @Test
|
|
69
|
+ public void equalIsNotTest2(){
|
|
70
|
+ Boolean actual = stringsAndThings.equalIsNot("This is notnot");
|
|
71
|
+ Assert.assertTrue(actual);
|
|
72
|
+ }
|
|
73
|
+
|
|
74
|
+ @Test
|
|
75
|
+ public void equalIsNotTest3(){
|
|
76
|
+ Boolean actual = stringsAndThings.equalIsNot("noisxxnotyynotxisi");
|
|
77
|
+ Assert.assertTrue(actual);
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ @Test
|
|
81
|
+ public void gIsHappyTest1(){
|
|
82
|
+ Boolean actual = stringsAndThings.gIsHappy("xxggxx");
|
|
83
|
+ Assert.assertTrue(actual);
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+ @Test
|
|
87
|
+ public void gIsHappyTest2(){
|
|
88
|
+ Boolean actual = stringsAndThings.gIsHappy("xxgxx");
|
|
89
|
+ Assert.assertFalse(actual);
|
|
90
|
+ }
|
|
91
|
+
|
|
92
|
+ @Test
|
|
93
|
+ public void gIsHappyTest3(){
|
|
94
|
+ Boolean actual = stringsAndThings.gIsHappy("xxggyygxx");
|
|
95
|
+ Assert.assertTrue(actual);
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ @Test
|
|
99
|
+ public void countTripleTest1(){
|
|
100
|
+ Integer expected = 1;
|
|
101
|
+ Integer actual = stringsAndThings.countTriple("abcXXXabc");
|
|
102
|
+ Assert.assertEquals(expected, actual);
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ @Test
|
|
106
|
+ public void countTripleTest2(){
|
|
107
|
+ Integer expected = 3;
|
|
108
|
+ Integer actual = stringsAndThings.countTriple("xxxabyyyycd");
|
|
109
|
+ Assert.assertEquals(expected, actual);
|
|
110
|
+ }
|
|
111
|
+
|
|
112
|
+ @Test
|
|
113
|
+ public void countTripleTest3(){
|
|
114
|
+ Integer expected = 0;
|
|
115
|
+ Integer actual = stringsAndThings.countTriple("a");
|
|
116
|
+ Assert.assertEquals(expected, actual);
|
|
117
|
+ }
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+}
|