Leon 6 år sedan
förälder
incheckning
16669b4efb
45 ändrade filer med 1173 tillägg och 396 borttagningar
  1. 6
    0
      .idea/vcs.xml
  2. 439
    388
      .idea/workspace.xml
  3. 1
    1
      src/main/java/rocks/zipcode/io/quiz3/arrays/TicTacToe.java
  4. 1
    0
      src/main/java/rocks/zipcode/io/quiz3/arrays/WaveGenerator.java
  5. 0
    4
      src/main/java/rocks/zipcode/io/quiz3/collections/ShoeFitter.java
  6. 7
    3
      src/main/java/rocks/zipcode/io/quiz3/fundamentals/StringUtils.java
  7. 52
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareAssortedArrays.java
  8. 53
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareSortedArrays.java
  9. 22
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/ConstructorTest.java
  10. 64
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/GetColumnTest.java
  11. 64
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/GetRowTest.java
  12. 39
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/GetWinner.java
  13. 64
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/IsColumnHomogeneousTest.java
  14. 64
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/IsRowHomogeneousTest.java
  15. 151
    0
      src/test/java/rocks/zipcode/io/quiz3/arrays/wavegenerator/WaveTest.java
  16. 49
    0
      src/test/java/rocks/zipcode/io/quiz3/fundamentals/stringutils/IsCharacterAtIndex.java
  17. 43
    0
      src/test/java/rocks/zipcode/io/quiz3/fundamentals/vowelutils/GetIndexOfFirstVowel.java
  18. 21
    0
      src/test/java/rocks/zipcode/io/quiz3/fundamentals/vowelutils/HasVowels.java
  19. 33
    0
      src/test/java/rocks/zipcode/io/quiz3/fundamentals/vowelutils/IsVowel.java
  20. Binär
      target/classes/rocks/zipcode/io/quiz3/arrays/TicTacToe.class
  21. Binär
      target/classes/rocks/zipcode/io/quiz3/arrays/WaveGenerator.class
  22. Binär
      target/classes/rocks/zipcode/io/quiz3/collections/ShoeFitter.class
  23. Binär
      target/classes/rocks/zipcode/io/quiz3/fundamentals/StringUtils.class
  24. Binär
      target/classes/rocks/zipcode/io/quiz3/generics/ArrayUtility.class
  25. Binär
      target/test-classes/rocks/zipcode/io/quiz3/TestUtils.class
  26. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareAssortedArrays.class
  27. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareSortedArrays.class
  28. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/ConstructorTest.class
  29. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/GetColumnTest.class
  30. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/GetRowTest.class
  31. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/GetWinner.class
  32. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/IsColumnHomogeneousTest.class
  33. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/IsRowHomogeneousTest.class
  34. Binär
      target/test-classes/rocks/zipcode/io/quiz3/arrays/wavegenerator/WaveTest.class
  35. Binär
      target/test-classes/rocks/zipcode/io/quiz3/fundamentals/stringutils/IsCharacterAtIndex.class
  36. Binär
      target/test-classes/rocks/zipcode/io/quiz3/fundamentals/vowelutils/GetIndexOfFirstVowel.class
  37. Binär
      target/test-classes/rocks/zipcode/io/quiz3/fundamentals/vowelutils/HasVowels.class
  38. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerFilterTest.class
  39. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerFindEvenOccurringValue.class
  40. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerFindOddOccurringValue.class
  41. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerGetNumberOfOccurrences.class
  42. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringFilterTest.class
  43. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringFindEvenOccurringValueTest.class
  44. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringFindOddOccurringValueTest.class
  45. Binär
      target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringGetNumberOfOccurrencesTest.class

+ 6
- 0
.idea/vcs.xml Visa fil

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 439
- 388
.idea/workspace.xml
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 1
- 1
src/main/java/rocks/zipcode/io/quiz3/arrays/TicTacToe.java Visa fil

@@ -22,7 +22,7 @@ public class TicTacToe {
22 22
         return null;
23 23
     }
24 24
 
25
-    public Boolean isColumnHomogenous(Integer value) {
25
+    public Boolean isColumnHomogeneous(Integer value) {
26 26
         return null;
27 27
     }
28 28
 

+ 1
- 0
src/main/java/rocks/zipcode/io/quiz3/arrays/WaveGenerator.java Visa fil

@@ -10,6 +10,7 @@ import java.util.List;
10 10
  */
11 11
 public class WaveGenerator {
12 12
     public static String[] wave(String str) {
13
+        str = str.toLowerCase();
13 14
         List<String> list = new ArrayList<>();
14 15
         for (int i = 0; i < str.length(); i++) {
15 16
             String currentCharacter = String.valueOf(str.charAt(i));

+ 0
- 4
src/main/java/rocks/zipcode/io/quiz3/collections/ShoeFitter.java Visa fil

@@ -6,10 +6,6 @@ import java.util.Map;
6 6
  * @author leon on 09/12/2018.
7 7
  */
8 8
 public class ShoeFitter {
9
-    public ShoeFitter(Map<Person, ShoeSize> shoeSizeMap) {
10
-
11
-    }
12
-
13 9
     public ShoeFitter() {
14 10
     }
15 11
 

+ 7
- 3
src/main/java/rocks/zipcode/io/quiz3/fundamentals/StringUtils.java Visa fil

@@ -4,11 +4,15 @@ package rocks.zipcode.io.quiz3.fundamentals;
4 4
  * @author leon on 09/12/2018.
5 5
  */
6 6
 public class StringUtils {
7
-    public static String capitalizeNthCharacter(String baseString, Integer indexToCapitalize) {
8
-        throw new UnsupportedOperationException("Method not yet implemented");
7
+    public static String capitalizeNthCharacter(String str, Integer indexToCapitalize) {
8
+        String prefix = str.substring(0, indexToCapitalize);
9
+        String suffix = str.substring(indexToCapitalize+1, str.length());
10
+        String charToCapitalize = String.valueOf(str.charAt(indexToCapitalize));
11
+        String result = prefix + charToCapitalize.toUpperCase() + suffix + "";
12
+        return result;
9 13
     }
10 14
 
11
-    public static Boolean isCharacterAtIndex(String baseString, char c) {
15
+    public static Boolean isCharacterAtIndex(String baseString, Character characterToCheckFor, Integer indexOfString) {
12 16
         return null;
13 17
     }
14 18
 }

+ 52
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareAssortedArrays.java Visa fil

@@ -0,0 +1,52 @@
1
+package rocks.zipcode.io.quiz3.arrays.squarearrayanalyzer;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.arrays.SquareArrayAnalyzer;
6
+
7
+import java.util.Arrays;
8
+import java.util.Collections;
9
+import java.util.List;
10
+
11
+/**
12
+ * @author leon on 10/12/2018.
13
+ */
14
+public class CompareAssortedArrays {
15
+
16
+    @Test
17
+    public void test1() {
18
+        Integer[] array = {1, 2, 3};
19
+        Integer[] arraySquared = {1, 4, 9};
20
+        assortAndCompare(array, arraySquared);
21
+    }
22
+
23
+    @Test
24
+    public void test2() {
25
+        Integer[] array = {3, 4, 5};
26
+        Integer[] arraySquared = {9, 16, 25};
27
+        assortAndCompare(array, arraySquared);
28
+    }
29
+
30
+    @Test
31
+    public void test3() {
32
+        Integer[] array = {121, 144, 19, 161, 19, 144, 19, 11};
33
+        Integer[] arraySquared = {121, 14641, 20736, 361, 25921, 361, 20736, 361};
34
+        assortAndCompare(array, arraySquared);
35
+    }
36
+    
37
+    private void assortAndCompare(Integer[] array1, Integer[] array2) {
38
+        List<Integer> intList1 = Arrays.asList(array1);
39
+        List<Integer> intList2 = Arrays.asList(array2);
40
+        
41
+        Collections.shuffle(intList1);
42
+        Collections.shuffle(intList2);
43
+        
44
+        array1 = intList1.toArray(new Integer[intList1.size()]);
45
+        array2 = intList2.toArray(new Integer[intList2.size()]);
46
+        
47
+        Assert.assertTrue(SquareArrayAnalyzer.compare(array1, array2));
48
+    }
49
+    
50
+    
51
+
52
+}

+ 53
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareSortedArrays.java Visa fil

@@ -0,0 +1,53 @@
1
+package rocks.zipcode.io.quiz3.arrays.squarearrayanalyzer;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.arrays.SquareArrayAnalyzer;
6
+
7
+/**
8
+ * @author leon on 10/12/2018.
9
+ */
10
+public class CompareSortedArrays {
11
+
12
+    @Test
13
+    public void test0() {
14
+        Integer[] array = {1};
15
+        Integer[] arraySquared = {1};
16
+        Assert.assertTrue(SquareArrayAnalyzer.compare(array, arraySquared));
17
+    }
18
+
19
+    @Test
20
+    public void test1() {
21
+        Integer[] array = {2};
22
+        Integer[] arraySquared = {4};
23
+        Assert.assertTrue(SquareArrayAnalyzer.compare(array, arraySquared));
24
+    }
25
+
26
+    @Test
27
+    public void test2() {
28
+        Integer[] array = {3};
29
+        Integer[] arraySquared = {9};
30
+        Assert.assertTrue(SquareArrayAnalyzer.compare(array, arraySquared));
31
+    }
32
+
33
+    @Test
34
+    public void test3() {
35
+        Integer[] array = {1,2,3};
36
+        Integer[] arraySquared = {1,4,9};
37
+        Assert.assertTrue(SquareArrayAnalyzer.compare(array, arraySquared));
38
+    }
39
+
40
+    @Test
41
+    public void test4() {
42
+        Integer[] array = {3,4,5,};
43
+        Integer[] arraySquared = {9,16,25};
44
+        Assert.assertTrue(SquareArrayAnalyzer.compare(array, arraySquared));
45
+    }
46
+
47
+    @Test
48
+    public void test5() {
49
+        Integer[] array = {121, 144, 19, 161, 19, 144, 19, 11};
50
+        Integer[] arraySquared = {121, 14641, 20736, 361, 25921, 361, 20736, 361};
51
+        Assert.assertTrue(SquareArrayAnalyzer.compare(array, arraySquared));
52
+    }
53
+}

+ 22
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/ConstructorTest.java Visa fil

@@ -0,0 +1,22 @@
1
+package rocks.zipcode.io.quiz3.arrays.tictactoe;
2
+
3
+import org.junit.Test;
4
+import rocks.zipcode.io.quiz3.arrays.TicTacToe;
5
+
6
+/**
7
+ * @author leon on 10/12/2018.
8
+ */
9
+public class ConstructorTest {
10
+    //    @Test
11
+    public void nullaryConstructor() {
12
+    }
13
+
14
+    @Test
15
+    public void parametrizedConstructor() {
16
+        String[] row1 = {"X", "O", "X"};
17
+        String[] row2 = {"O", "X", "O"};
18
+        String[] row3 = {"O", "X", "O"};
19
+        String[][] board = {row1, row2, row3};
20
+        TicTacToe ticTacToe = new TicTacToe(board);
21
+    }
22
+}

+ 64
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/GetColumnTest.java Visa fil

@@ -0,0 +1,64 @@
1
+package rocks.zipcode.io.quiz3.arrays.tictactoe;
2
+
3
+import org.junit.Test;
4
+import rocks.zipcode.io.quiz3.TestUtils;
5
+import rocks.zipcode.io.quiz3.arrays.TicTacToe;
6
+
7
+/**
8
+ * @author leon on 10/12/2018.
9
+ */
10
+public class GetColumnTest {
11
+    @Test
12
+    public void test1() {
13
+        // given
14
+        String[] row1 = {"X", "O", "X"};
15
+        String[] row2 = {"O", "X", "O"};
16
+        String[] row3 = {"O", "X", "O"};
17
+        String[][] board = {row1, row2, row3};
18
+        TicTacToe ticTacToe = new TicTacToe(board);
19
+        Integer columnIndexToFetch = 0;
20
+        String[] expected = {"X", "O", "O"};
21
+
22
+        // when
23
+        String[] actual = ticTacToe.getColumn(columnIndexToFetch);
24
+
25
+        // then
26
+        TestUtils.assertArrayEquals(expected, actual);
27
+    }
28
+
29
+    @Test
30
+    public void test2() {
31
+        // given
32
+        String[] row1 = {"X", "O", "X"};
33
+        String[] row2 = {"O", "X", "O"};
34
+        String[] row3 = {"O", "X", "O"};
35
+        String[][] board = {row1, row2, row3};
36
+        TicTacToe ticTacToe = new TicTacToe(board);
37
+        Integer columnIndexToFetch = 1;
38
+        String[] expected = {"O", "X", "X"};
39
+
40
+        // when
41
+        String[] actual = ticTacToe.getColumn(columnIndexToFetch);
42
+
43
+        // then
44
+        TestUtils.assertArrayEquals(expected, actual);
45
+    }
46
+
47
+    @Test
48
+    public void test3() {
49
+        // given
50
+        String[] row1 = {"X", "O", "X"};
51
+        String[] row2 = {"O", "X", "X"};
52
+        String[] row3 = {"O", "X", "O"};
53
+        String[][] board = {row1, row2, row3};
54
+        TicTacToe ticTacToe = new TicTacToe(board);
55
+        Integer columnIndexToFetch = 2;
56
+        String[] expected = {"X", "X", "O"};
57
+
58
+        // when
59
+        String[] actual = ticTacToe.getColumn(columnIndexToFetch);
60
+
61
+        // then
62
+        TestUtils.assertArrayEquals(expected, actual);
63
+    }
64
+}

+ 64
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/GetRowTest.java Visa fil

@@ -0,0 +1,64 @@
1
+package rocks.zipcode.io.quiz3.arrays.tictactoe;
2
+
3
+import org.junit.Test;
4
+import rocks.zipcode.io.quiz3.TestUtils;
5
+import rocks.zipcode.io.quiz3.arrays.TicTacToe;
6
+
7
+/**
8
+ * @author leon on 10/12/2018.
9
+ */
10
+public class GetRowTest {
11
+    @Test
12
+    public void test1() {
13
+        // given
14
+        String[] row1 = {"X", "O", "X"};
15
+        String[] row2 = {"O", "X", "O"};
16
+        String[] row3 = {"O", "X", "O"};
17
+        String[][] board = {row1, row2, row3};
18
+        TicTacToe ticTacToe = new TicTacToe(board);
19
+        Integer indexToFetch = 0;
20
+        String[] expected = row1;
21
+
22
+        // when
23
+        String[] actual = ticTacToe.getRow(indexToFetch);
24
+
25
+        // then
26
+        TestUtils.assertArrayEquals(expected, actual);
27
+    }
28
+
29
+    @Test
30
+    public void test2() {
31
+        // given
32
+        String[] row1 = {"X", "O", "X"};
33
+        String[] row2 = {"O", "X", "O"};
34
+        String[] row3 = {"O", "X", "O"};
35
+        String[][] board = {row1, row2, row3};
36
+        TicTacToe ticTacToe = new TicTacToe(board);
37
+        Integer indexToFetch = 1;
38
+        String[] expected = row2;
39
+
40
+        // when
41
+        String[] actual = ticTacToe.getRow(indexToFetch);
42
+
43
+        // then
44
+        TestUtils.assertArrayEquals(expected, actual);
45
+    }
46
+
47
+    @Test
48
+    public void test3() {
49
+        // given
50
+        String[] row1 = {"X", "O", "X"};
51
+        String[] row2 = {"O", "X", "O"};
52
+        String[] row3 = {"O", "X", "O"};
53
+        String[][] board = {row1, row2, row3};
54
+        TicTacToe ticTacToe = new TicTacToe(board);
55
+        Integer indexToFetch = 2;
56
+        String[] expected = row3;
57
+
58
+        // when
59
+        String[] actual = ticTacToe.getRow(indexToFetch);
60
+
61
+        // then
62
+        TestUtils.assertArrayEquals(expected, actual);
63
+    }
64
+}

+ 39
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/GetWinner.java Visa fil

@@ -0,0 +1,39 @@
1
+package rocks.zipcode.io.quiz3.arrays.tictactoe;
2
+
3
+import org.junit.Test;
4
+import rocks.zipcode.io.quiz3.arrays.TicTacToe;
5
+
6
+/**
7
+ * @author leon on 10/12/2018.
8
+ */
9
+public class GetWinner {
10
+    @Test
11
+    public void test1() {
12
+        // given
13
+        String[] row1 = {"X", "O", "X"};
14
+        String[] row2 = {"O", "X", "O"};
15
+        String[] row3 = {"O", "X", "O"};
16
+        String[][] board = {row1, row2, row3};
17
+        TicTacToe ticTacToe = new TicTacToe(board);
18
+    }
19
+
20
+    @Test
21
+    public void test2() {
22
+        // given
23
+        String[] row1 = {"X", "O", "X"};
24
+        String[] row2 = {"O", "X", "O"};
25
+        String[] row3 = {"O", "X", "O"};
26
+        String[][] board = {row1, row2, row3};
27
+        TicTacToe ticTacToe = new TicTacToe(board);
28
+    }
29
+
30
+    @Test
31
+    public void test3() {
32
+        // given
33
+        String[] row1 = {"X", "O", "X"};
34
+        String[] row2 = {"O", "X", "O"};
35
+        String[] row3 = {"O", "X", "O"};
36
+        String[][] board = {row1, row2, row3};
37
+        TicTacToe ticTacToe = new TicTacToe(board);
38
+    }
39
+}

+ 64
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/IsColumnHomogeneousTest.java Visa fil

@@ -0,0 +1,64 @@
1
+package rocks.zipcode.io.quiz3.arrays.tictactoe;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.arrays.TicTacToe;
6
+
7
+/**
8
+ * @author leon on 10/12/2018.
9
+ */
10
+public class IsColumnHomogeneousTest {
11
+    @Test
12
+    public void test1() {
13
+        // given
14
+        String[] row1 = {"O", "X", "X"};
15
+        String[] row2 = {"O", "X", "O"};
16
+        String[] row3 = {"O", "X", "O"};
17
+        String[][] board = {row1, row2, row3};
18
+        TicTacToe ticTacToe = new TicTacToe(board);
19
+        Integer columnIndex = 0;
20
+
21
+        Assert.assertTrue(ticTacToe.isColumnHomogeneous(columnIndex));
22
+    }
23
+
24
+    @Test
25
+    public void test2() {
26
+        // given
27
+        String[] row1 = {"O", "X", "X"};
28
+        String[] row2 = {"X", "X", "O"};
29
+        String[] row3 = {"O", "X", "O"};
30
+        String[][] board = {row1, row2, row3};
31
+        TicTacToe ticTacToe = new TicTacToe(board);
32
+        Integer columnIndex = 0;
33
+
34
+        Assert.assertFalse(ticTacToe.isColumnHomogeneous(columnIndex));
35
+    }
36
+
37
+
38
+    @Test
39
+    public void test3() {
40
+        // given
41
+        String[] row1 = {"O", "X", "X"};
42
+        String[] row2 = {"O", "X", "O"};
43
+        String[] row3 = {"O", "X", "O"};
44
+        String[][] board = {row1, row2, row3};
45
+        TicTacToe ticTacToe = new TicTacToe(board);
46
+        Integer columnIndex = 1;
47
+
48
+        Assert.assertTrue(ticTacToe.isColumnHomogeneous(columnIndex));
49
+    }
50
+
51
+    @Test
52
+    public void test4() {
53
+        // given
54
+        String[] row1 = {"O", "X", "X"};
55
+        String[] row2 = {"O", "X", "O"};
56
+        String[] row3 = {"O", "X", "O"};
57
+        String[][] board = {row1, row2, row3};
58
+        TicTacToe ticTacToe = new TicTacToe(board);
59
+        Integer columnIndex = 2;
60
+
61
+        Assert.assertFalse(ticTacToe.isColumnHomogeneous(columnIndex));
62
+    }
63
+
64
+}

+ 64
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/tictactoe/IsRowHomogeneousTest.java Visa fil

@@ -0,0 +1,64 @@
1
+package rocks.zipcode.io.quiz3.arrays.tictactoe;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.arrays.TicTacToe;
6
+
7
+/**
8
+ * @author leon on 10/12/2018.
9
+ */
10
+public class IsRowHomogeneousTest {
11
+    @Test
12
+    public void test1() {
13
+        // given
14
+        String[] row1 = {"X", "X", "X"};
15
+        String[] row2 = {"O", "O", "O"};
16
+        String[] row3 = {"O", "X", "O"};
17
+        String[][] board = {row1, row2, row3};
18
+        TicTacToe ticTacToe = new TicTacToe(board);
19
+        Integer rowIndex = 0;
20
+
21
+        Assert.assertTrue(ticTacToe.isRowHomogenous(rowIndex));
22
+    }
23
+
24
+    @Test
25
+    public void test2() {
26
+        // given
27
+        String[] row1 = {"X", "X", "X"};
28
+        String[] row2 = {"O", "O", "O"};
29
+        String[] row3 = {"O", "X", "O"};
30
+        String[][] board = {row1, row2, row3};
31
+        TicTacToe ticTacToe = new TicTacToe(board);
32
+        Integer rowIndex = 1;
33
+
34
+        Assert.assertTrue(ticTacToe.isRowHomogenous(rowIndex));
35
+    }
36
+
37
+
38
+    @Test
39
+    public void test3() {
40
+        // given
41
+        String[] row1 = {"X", "X", "X"};
42
+        String[] row2 = {"O", "O", "O"};
43
+        String[] row3 = {"O", "X", "O"};
44
+        String[][] board = {row1, row2, row3};
45
+        TicTacToe ticTacToe = new TicTacToe(board);
46
+        Integer rowIndex = 2;
47
+
48
+        Assert.assertFalse(ticTacToe.isRowHomogenous(rowIndex));
49
+    }
50
+
51
+
52
+    @Test
53
+    public void test4() {
54
+        // given
55
+        String[] row1 = {"X", "O", "X"};
56
+        String[] row2 = {"O", "X", "O"};
57
+        String[] row3 = {"O", "O", "O"};
58
+        String[][] board = {row1, row2, row3};
59
+        TicTacToe ticTacToe = new TicTacToe(board);
60
+        Integer rowIndex = 2;
61
+
62
+        Assert.assertTrue(ticTacToe.isRowHomogenous(rowIndex));
63
+    }
64
+}

+ 151
- 0
src/test/java/rocks/zipcode/io/quiz3/arrays/wavegenerator/WaveTest.java Visa fil

@@ -0,0 +1,151 @@
1
+package rocks.zipcode.io.quiz3.arrays.wavegenerator;
2
+
3
+import org.junit.Test;
4
+import rocks.zipcode.io.quiz3.TestUtils;
5
+import rocks.zipcode.io.quiz3.arrays.WaveGenerator;
6
+
7
+/**
8
+ * @author leon on 10/12/2018.
9
+ */
10
+public class WaveTest {
11
+    @Test
12
+    public void test0() {
13
+        // given
14
+        String input = "AAAAAAA";
15
+        String[] expected = {
16
+                "Aaaaaaa",
17
+                "aAaaaaa",
18
+                "aaAaaaa",
19
+                "aaaAaaa",
20
+                "aaaaAaa",
21
+                "aaaaaAa",
22
+                "aaaaaaA"};
23
+
24
+        // when
25
+        String[] actual = WaveGenerator.wave(input);
26
+
27
+        // then
28
+        TestUtils.assertArrayEquals(expected, actual);
29
+    }
30
+
31
+    @Test
32
+    public void test1() {
33
+        // given
34
+        String input = "aaaaaaa";
35
+        String[] expected = {
36
+                "Aaaaaaa",
37
+                "aAaaaaa",
38
+                "aaAaaaa",
39
+                "aaaAaaa",
40
+                "aaaaAaa",
41
+                "aaaaaAa",
42
+                "aaaaaaA"};
43
+
44
+        // when
45
+        String[] actual = WaveGenerator.wave(input);
46
+
47
+        // then
48
+        TestUtils.assertArrayEquals(expected, actual);
49
+    }
50
+
51
+    @Test
52
+    public void test2() {
53
+        // given
54
+        String input = "A_A_A";
55
+        String[] expected = {
56
+                "A_a_a",
57
+                "a_A_a",
58
+                "a_a_A"};
59
+
60
+        // when
61
+        String[] actual = WaveGenerator.wave(input);
62
+
63
+        // then
64
+        TestUtils.assertArrayEquals(expected, actual);
65
+    }
66
+
67
+
68
+    @Test
69
+    public void test4() {
70
+        // given
71
+        String input = "Radioactivity";
72
+        String[] expected = {
73
+                "Radioactivity",
74
+                "rAdioactivity",
75
+                "raDioactivity",
76
+                "radIoactivity",
77
+                "radiOactivity",
78
+                "radioActivity",
79
+                "radioaCtivity",
80
+                "radioacTivity",
81
+                "radioactIvity",
82
+                "radioactiVity",
83
+                "radioactivIty",
84
+                "radioactiviTy",
85
+                "radioactivitY"};
86
+
87
+        // when
88
+        String[] actual = WaveGenerator.wave(input);
89
+
90
+        // then
91
+        TestUtils.assertArrayEquals(expected, actual);
92
+    }
93
+
94
+    @Test
95
+    public void test5() {
96
+        // given
97
+        String input = "the quick brown fox";
98
+        String[] expected = {
99
+                "The quick brown fox",
100
+                "tHe quick brown fox",
101
+                "thE quick brown fox",
102
+                "the Quick brown fox",
103
+                "the qUick brown fox",
104
+                "the quIck brown fox",
105
+                "the quiCk brown fox",
106
+                "the quicK brown fox",
107
+                "the quick Brown fox",
108
+                "the quick bRown fox",
109
+                "the quick brOwn fox",
110
+                "the quick broWn fox",
111
+                "the quick browN fox",
112
+                "the quick brown Fox",
113
+                "the quick brown fOx",
114
+                "the quick brown foX"};
115
+
116
+        // when
117
+        String[] actual = WaveGenerator.wave(input);
118
+
119
+        // then
120
+        TestUtils.assertArrayEquals(expected, actual);
121
+    }
122
+
123
+
124
+    @Test
125
+    public void test6() {
126
+        // given
127
+        String input = "the quick brown f0x!";
128
+        String[] expected = {
129
+                "The quick brown f0x!",
130
+                "tHe quick brown f0x!",
131
+                "thE quick brown f0x!",
132
+                "the Quick brown f0x!",
133
+                "the qUick brown f0x!",
134
+                "the quIck brown f0x!",
135
+                "the quiCk brown f0x!",
136
+                "the quicK brown f0x!",
137
+                "the quick Brown f0x!",
138
+                "the quick bRown f0x!",
139
+                "the quick brOwn f0x!",
140
+                "the quick broWn f0x!",
141
+                "the quick browN f0x!",
142
+                "the quick brown F0x!",
143
+                "the quick brown f0X!"};
144
+
145
+        // when
146
+        String[] actual = WaveGenerator.wave(input);
147
+
148
+        // then
149
+        TestUtils.assertArrayEquals(expected, actual);
150
+    }
151
+}

+ 49
- 0
src/test/java/rocks/zipcode/io/quiz3/fundamentals/stringutils/IsCharacterAtIndex.java Visa fil

@@ -1,7 +1,56 @@
1 1
 package rocks.zipcode.io.quiz3.fundamentals.stringutils;
2 2
 
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.fundamentals.StringUtils;
6
+
3 7
 /**
4 8
  * @author leon on 09/12/2018.
5 9
  */
6 10
 public class IsCharacterAtIndex {
11
+    @Test
12
+    public void test1() {
13
+        // given
14
+        String string = "Quickly";
15
+        Character character = 'q';
16
+        Integer index = 0;
17
+
18
+        // then
19
+        Assert.assertTrue(StringUtils.isCharacterAtIndex(string, character, index));
20
+    }
21
+
22
+    @Test
23
+    public void test2() {
24
+        // given
25
+        String string = "Quickly";
26
+        Character character = 'Q';
27
+        Integer index = 0;
28
+
29
+        // then
30
+        Assert.assertFalse(StringUtils.isCharacterAtIndex(string, character, index));
31
+    }
32
+
33
+
34
+    @Test
35
+    public void test3() {
36
+        // given
37
+        String string = "Quickly";
38
+        Character character = 'y';
39
+        Integer index = 6;
40
+
41
+        // then
42
+        Assert.assertTrue(StringUtils.isCharacterAtIndex(string, character, index));
43
+    }
44
+
45
+    @Test
46
+    public void test4() {
47
+        // given
48
+        String string = "Quickly";
49
+        Character character = 'Y';
50
+        Integer index = 6;
51
+
52
+        // then
53
+        Assert.assertFalse(StringUtils.isCharacterAtIndex(string, character, index));
54
+    }
55
+
7 56
 }

+ 43
- 0
src/test/java/rocks/zipcode/io/quiz3/fundamentals/vowelutils/GetIndexOfFirstVowel.java Visa fil

@@ -1,7 +1,50 @@
1 1
 package rocks.zipcode.io.quiz3.fundamentals.vowelutils;
2 2
 
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.fundamentals.VowelUtils;
6
+
3 7
 /**
4 8
  * @author leon on 09/12/2018.
5 9
  */
6 10
 public class GetIndexOfFirstVowel {
11
+    @Test
12
+    public void test1() {
13
+        // given
14
+        String input = "Psychological Warfare";
15
+        Integer expected = 5;
16
+
17
+        // when
18
+        Integer actual = VowelUtils.getIndexOfFirstVowel(input);
19
+
20
+        // then
21
+        Assert.assertEquals(expected, actual);
22
+    }
23
+
24
+    @Test
25
+    public void test2() {
26
+        // given
27
+        String input = "Psych!";
28
+        Integer expected = null;
29
+
30
+        // when
31
+        Integer actual = VowelUtils.getIndexOfFirstVowel(input);
32
+
33
+        // then
34
+        Assert.assertEquals(expected, actual);
35
+    }
36
+
37
+
38
+    @Test
39
+    public void test3() {
40
+        // given
41
+        String input = "Pterodactyl";
42
+        Integer expected = 2;
43
+
44
+        // when
45
+        Integer actual = VowelUtils.getIndexOfFirstVowel(input);
46
+
47
+        // then
48
+        Assert.assertEquals(expected, actual);
49
+    }
7 50
 }

+ 21
- 0
src/test/java/rocks/zipcode/io/quiz3/fundamentals/vowelutils/HasVowels.java Visa fil

@@ -1,7 +1,28 @@
1 1
 package rocks.zipcode.io.quiz3.fundamentals.vowelutils;
2 2
 
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.fundamentals.VowelUtils;
6
+
3 7
 /**
4 8
  * @author leon on 09/12/2018.
5 9
  */
6 10
 public class HasVowels {
11
+    @Test
12
+    public void test1() {
13
+        String input = "qwrtypsdfghjklzxcvbnm";
14
+        Assert.assertFalse(VowelUtils.hasVowels(input));
15
+    }
16
+
17
+    @Test
18
+    public void test2() {
19
+        String input = "qwrtypsdfghjklzxcvbnma";
20
+        Assert.assertTrue(VowelUtils.hasVowels(input));
21
+    }
22
+
23
+    @Test
24
+    public void test3() {
25
+        String input = "qwrtypsdfghjklzxcvbnm_";
26
+        Assert.assertFalse(VowelUtils.hasVowels(input));
27
+    }
7 28
 }

+ 33
- 0
src/test/java/rocks/zipcode/io/quiz3/fundamentals/vowelutils/IsVowel.java Visa fil

@@ -1,7 +1,40 @@
1 1
 package rocks.zipcode.io.quiz3.fundamentals.vowelutils;
2 2
 
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+import rocks.zipcode.io.quiz3.fundamentals.VowelUtils;
6
+
3 7
 /**
4 8
  * @author leon on 09/12/2018.
5 9
  */
6 10
 public class IsVowel {
11
+    @Test
12
+    public void test1() {
13
+        Assert.assertTrue(VowelUtils.isVowel('a'));
14
+    }
15
+
16
+    @Test
17
+    public void test2() {
18
+        Assert.assertTrue(VowelUtils.isVowel('A'));
19
+    }
20
+
21
+    @Test
22
+    public void test3() {
23
+        Assert.assertTrue(VowelUtils.isVowel('E'));
24
+    }
25
+
26
+    @Test
27
+    public void test4() {
28
+        Assert.assertTrue(VowelUtils.isVowel('e'));
29
+    }
30
+
31
+    @Test
32
+    public void test5() {
33
+        Assert.assertTrue(VowelUtils.isVowel('I'));
34
+    }
35
+
36
+    @Test
37
+    public void test6() {
38
+        Assert.assertTrue(VowelUtils.isVowel('i'));
39
+    }
7 40
 }

Binär
target/classes/rocks/zipcode/io/quiz3/arrays/TicTacToe.class Visa fil


Binär
target/classes/rocks/zipcode/io/quiz3/arrays/WaveGenerator.class Visa fil


Binär
target/classes/rocks/zipcode/io/quiz3/collections/ShoeFitter.class Visa fil


Binär
target/classes/rocks/zipcode/io/quiz3/fundamentals/StringUtils.class Visa fil


Binär
target/classes/rocks/zipcode/io/quiz3/generics/ArrayUtility.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/TestUtils.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareAssortedArrays.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/squarearrayanalyzer/CompareSortedArrays.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/ConstructorTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/GetColumnTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/GetRowTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/GetWinner.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/IsColumnHomogeneousTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/tictactoe/IsRowHomogeneousTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/arrays/wavegenerator/WaveTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/fundamentals/stringutils/IsCharacterAtIndex.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/fundamentals/vowelutils/GetIndexOfFirstVowel.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/fundamentals/vowelutils/HasVowels.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerFilterTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerFindEvenOccurringValue.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerFindOddOccurringValue.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/integer/IntegerGetNumberOfOccurrences.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringFilterTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringFindEvenOccurringValueTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringFindOddOccurringValueTest.class Visa fil


Binär
target/test-classes/rocks/zipcode/io/quiz3/generics/arrayutility/string/StringGetNumberOfOccurrencesTest.class Visa fil