Kaynağa Gözat

created an additional oop class & tests

Leon 6 yıl önce
ebeveyn
işleme
8dcb8d3769

+ 0
- 7
src/test/java/rocks/zipcode/io/quiz4/collections/simplestringgroup/ToStringTest.java Dosyayı Görüntüle

@@ -1,7 +0,0 @@
1
-package rocks.zipcode.io.quiz4.collections.simplestringgroup;
2
-
3
-/**
4
- * @author leon on 11/12/2018.
5
- */
6
-public class ToStringTest {
7
-}

+ 0
- 7
src/test/java/rocks/zipcode/io/quiz4/collections/simplestringgroup/WhereTest.java Dosyayı Görüntüle

@@ -1,7 +0,0 @@
1
-package rocks.zipcode.io.quiz4.collections.simplestringgroup;
2
-
3
-/**
4
- * @author leon on 11/12/2018.
5
- */
6
-public class WhereTest {
7
-}

+ 52
- 0
src/test/java/rocks/zipcode/io/quiz4/fundamentals/palindromeevaluator/PalindromeEvaluatorGetAllPalindromesTest.java Dosyayı Görüntüle

@@ -0,0 +1,52 @@
1
+package rocks.zipcode.io.quiz4.fundamentals.palindromeevaluator;
2
+
3
+import org.junit.Test;
4
+import rocks.zipcode.io.quiz4.fundamentals.PalindromeEvaluator;
5
+import rocks.zipcode.io.quiz4.objectorientation.PalindromeObject;
6
+import rocks.zipcode.io.quiz4.utils.TestUtils;
7
+
8
+/**
9
+ * @author leon on 11/12/2018.
10
+ */
11
+public class PalindromeEvaluatorGetAllPalindromesTest {
12
+    @Test
13
+    public void test1() {
14
+        // given
15
+        String input = "racecar";
16
+        String[] expected = new String[]{"a", "aceca", "c", "cec", "e", "r", "racecar"};
17
+        test(input, expected);
18
+    }
19
+
20
+    @Test
21
+    public void test2() {
22
+        // given
23
+        String input = "redder";
24
+        String[] expected = new String[]{"d", "dd", "e", "edde", "r", "redder"};
25
+        test(input, expected);
26
+    }
27
+
28
+
29
+    @Test
30
+    public void test3() {
31
+        // given
32
+        String input = "rotor";
33
+        String[] expected = new String[]{"o", "oto", "r", "rotor", "t"};
34
+        test(input, expected);
35
+    }
36
+
37
+    @Test
38
+    public void test4() {
39
+        // given
40
+        String input = "civic";
41
+        String[] expected = new String[]{"c", "civic", "i", "ivi", "v"};
42
+        test(input, expected);
43
+    }
44
+
45
+    public void test(String input, String... expected) {
46
+        // when
47
+        String[] actual = PalindromeEvaluator.getAllPalindromes(input);
48
+
49
+        // then
50
+        TestUtils.assertArrayEquals(expected, actual);
51
+    }
52
+}

+ 30
- 0
src/test/java/rocks/zipcode/io/quiz4/fundamentals/palindromeevaluator/PalindromeEvaluatorIsPalindromeTestNegative.java Dosyayı Görüntüle

@@ -0,0 +1,30 @@
1
+package rocks.zipcode.io.quiz4.fundamentals.palindromeevaluator;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz4.fundamentals.PalindromeEvaluator;
6
+import rocks.zipcode.io.quiz4.objectorientation.PalindromeObject;
7
+
8
+/**
9
+ * @author leon on 18/12/2018.
10
+ */
11
+public class PalindromeEvaluatorIsPalindromeTestNegative {
12
+    @Test
13
+    public void test1() {
14
+        test("Racecar");
15
+    }
16
+
17
+    @Test
18
+    public void test2() {
19
+        test("Redder");
20
+    }
21
+
22
+    @Test
23
+    public void test3() {
24
+        test("Redrum murder");
25
+    }
26
+
27
+    public void test(String input) {
28
+        Assert.assertTrue(PalindromeEvaluator.isPalindrome(input));
29
+    }
30
+}

+ 35
- 0
src/test/java/rocks/zipcode/io/quiz4/fundamentals/palindromeevaluator/PalindromeEvaluatorIsPalindromeTestPositive.java Dosyayı Görüntüle

@@ -0,0 +1,35 @@
1
+package rocks.zipcode.io.quiz4.fundamentals.palindromeevaluator;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz4.fundamentals.PalindromeEvaluator;
6
+import rocks.zipcode.io.quiz4.objectorientation.PalindromeObject;
7
+
8
+/**
9
+ * @author leon on 18/12/2018.
10
+ */
11
+public class PalindromeEvaluatorIsPalindromeTestPositive {
12
+    @Test
13
+    public void test1() {
14
+        test("racecar");
15
+    }
16
+
17
+    @Test
18
+    public void test2() {
19
+        test("racEcar");
20
+    }
21
+    
22
+    @Test
23
+    public void test3() {
24
+        test("redder");
25
+    }
26
+    
27
+    @Test
28
+    public void test4() {
29
+        test("redrum murder");
30
+    }
31
+    
32
+    public void test(String input) {
33
+        Assert.assertTrue(PalindromeEvaluator.isPalindrome(input));
34
+    }
35
+}

+ 36
- 0
src/test/java/rocks/zipcode/io/quiz4/fundamentals/palindromeevaluator/PalindromeEvaluatorReverseTest.java Dosyayı Görüntüle

@@ -0,0 +1,36 @@
1
+package rocks.zipcode.io.quiz4.fundamentals.palindromeevaluator;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz4.fundamentals.PalindromeEvaluator;
6
+import rocks.zipcode.io.quiz4.objectorientation.PalindromeObject;
7
+
8
+/**
9
+ * @author leon on 18/12/2018.
10
+ */
11
+public class PalindromeEvaluatorReverseTest {
12
+    @Test
13
+    public void test1() {
14
+        test("leon", "noel");
15
+    }
16
+
17
+    @Test
18
+    public void test2() {
19
+        test("Jerry", "yrreJ");
20
+    }
21
+
22
+    @Test
23
+    public void test3() {
24
+        test("KJack", "kcaJK");
25
+    }
26
+
27
+    @Test
28
+    public void test4() {
29
+        test("redrum murder", "redrum murder");
30
+    }
31
+
32
+    public void test(String input, String expected) {
33
+        String actual = PalindromeEvaluator.reverseString(input);
34
+        Assert.assertEquals(expected, actual);
35
+    }
36
+}

+ 0
- 7
src/test/java/rocks/zipcode/io/quiz4/generics/group/integergroup/IntegerGroupWhereTest.java Dosyayı Görüntüle

@@ -1,7 +0,0 @@
1
-package rocks.zipcode.io.quiz4.generics.group.integergroup;
2
-
3
-/**
4
- * @author leon on 11/12/2018.
5
- */
6
-public class IntegerGroupWhereTest {
7
-}

+ 1
- 0
src/test/java/rocks/zipcode/io/quiz4/generics/sortedgroup/integersortedgroup/IntegerSortedGroupDeleteTest.java Dosyayı Görüntüle

@@ -7,6 +7,7 @@ import rocks.zipcode.io.quiz4.generics.SortedGroup;
7 7
 /**
8 8
  * @author leon on 11/12/2018.
9 9
  */
10
+@SuppressWarnings("all")
10 11
 public class IntegerSortedGroupDeleteTest {
11 12
     @Test
12 13
     public void test1() {

+ 1
- 0
src/test/java/rocks/zipcode/io/quiz4/generics/sortedgroup/stringsortedgroup/StringSortedGroupDeleteTest.java Dosyayı Görüntüle

@@ -7,6 +7,7 @@ import rocks.zipcode.io.quiz4.generics.SortedGroup;
7 7
 /**
8 8
  * @author leon on 11/12/2018.
9 9
  */
10
+@SuppressWarnings("all")
10 11
 public class StringSortedGroupDeleteTest {
11 12
     @Test
12 13
     public void test1() {