9 Commits

Author SHA1 Message Date
  Brandon Defrancis cf00a7b3c3 final 5 years ago
  Brandon Defrancis 443abd4ef9 Merge branch 'master' of https://git.zipcode.rocks/Cohort4.2/Quiz5 5 years ago
  Leon 10ac76ad0e update 5 years ago
  Leon f0c939e16b update 5 years ago
  Leon 4c54d130c7 update 5 years ago
  Leon 5f72e6dc5f update 5 years ago
  Leon aa72d9a451 update 5 years ago
  Leon 33120f10d8 update 5 years ago
  Leon b9baa214e7 update 5 years ago

+ 3
- 0
src/main/java/rocks/zipcode/quiz5/collections/WordCounter.java View File

3
 import java.util.Map;
3
 import java.util.Map;
4
 
4
 
5
 public class WordCounter {
5
 public class WordCounter {
6
+
7
+
8
+
6
     public WordCounter(String... strings) {
9
     public WordCounter(String... strings) {
7
     }
10
     }
8
 
11
 

+ 2
- 2
src/test/java/rocks/zipcode/quiz5/fundamentals/calculator/AddTest.java View File

11
     @Test
11
     @Test
12
     public void test1() {
12
     public void test1() {
13
         // given
13
         // given
14
-        test(98.5, 10.5, 88.5);
14
+        test(99.0, 10.5, 88.5);
15
     }
15
     }
16
 
16
 
17
     @Test
17
     @Test
44
         Double actual = calculator.add(input1, input2);
44
         Double actual = calculator.add(input1, input2);
45
 
45
 
46
         // then
46
         // then
47
-        Assert.assertEquals(expected, actual, 0);
47
+        Assert.assertEquals(expected, actual, 0.01);
48
     }
48
     }
49
 }
49
 }

+ 2
- 2
src/test/java/rocks/zipcode/quiz5/fundamentals/calculator/DivideTest.java View File

29
     @Test
29
     @Test
30
     public void test4() {
30
     public void test4() {
31
         // given
31
         // given
32
-        test(9.0, 63.0, 5.0);
32
+        test(12.6, 63.0, 5.0);
33
     }
33
     }
34
 
34
 
35
     @Test
35
     @Test
44
         Double actual = calculator.divide(input1, input2);
44
         Double actual = calculator.divide(input1, input2);
45
 
45
 
46
         // then
46
         // then
47
-        Assert.assertEquals(expected, actual, 0);
47
+        Assert.assertEquals(expected, actual, 0.01);
48
     }
48
     }
49
 }
49
 }

+ 1
- 1
src/test/java/rocks/zipcode/quiz5/fundamentals/calculator/SquareRootTest.java View File

40
         Double actual = calculator.squareRoot(input);
40
         Double actual = calculator.squareRoot(input);
41
 
41
 
42
         // then
42
         // then
43
-        Assert.assertEquals(expected, actual, 0);
43
+        Assert.assertEquals(expected, actual, 0.01);
44
     }
44
     }
45
 }
45
 }

+ 1
- 1
src/test/java/rocks/zipcode/quiz5/fundamentals/calculator/SquareRootsTest.java View File

24
     @Test
24
     @Test
25
     public void test3() {
25
     public void test3() {
26
         // given
26
         // given
27
-        test(new Double[]{12.0, 438.0, }, 144.0, 191844.0, 81.0);
27
+        test(new Double[]{12.0, 438.0, 9.0}, 144.0, 191844.0, 81.0);
28
     }
28
     }
29
 
29
 
30
     @Test
30
     @Test

+ 1
- 1
src/test/java/rocks/zipcode/quiz5/fundamentals/calculator/SquareTest.java View File

44
         Double actual = calculator.square(input);
44
         Double actual = calculator.square(input);
45
 
45
 
46
         // then
46
         // then
47
-        Assert.assertEquals(expected, actual, 0);
47
+        Assert.assertEquals(expected, actual, 0.01);
48
     }
48
     }
49
 }
49
 }

+ 1
- 1
src/test/java/rocks/zipcode/quiz5/fundamentals/stringutils/HasDuplicateConsecutiveCharactersTest.java View File

8
     @Test
8
     @Test
9
     public void test1() {
9
     public void test1() {
10
         String input = "Happy";
10
         String input = "Happy";
11
-        Assert.assertFalse(StringUtils.hasDuplicateConsecutiveCharacters(input));
11
+        Assert.assertTrue(StringUtils.hasDuplicateConsecutiveCharacters(input));
12
     }
12
     }
13
 
13
 
14
     @Test
14
     @Test

+ 6
- 6
src/test/java/rocks/zipcode/quiz5/objectorientation/bankaccount/DepositPositiveTest.java View File

17
 
17
 
18
     @Test(expected = IllegalArgumentException.class)
18
     @Test(expected = IllegalArgumentException.class)
19
     public void test2() {
19
     public void test2() {
20
-        test(10.0, 50.0);
20
+        test(10.0, -50.0);
21
     }
21
     }
22
 
22
 
23
     @Test(expected = IllegalArgumentException.class)
23
     @Test(expected = IllegalArgumentException.class)
24
     public void test3() {
24
     public void test3() {
25
-        test(55.0, 500.0);
25
+        test(55.0, -500.0);
26
     }
26
     }
27
 
27
 
28
     @Test(expected = IllegalArgumentException.class)
28
     @Test(expected = IllegalArgumentException.class)
29
     public void test4() {
29
     public void test4() {
30
-        test(78.0, 90.0);
30
+        test(78.0, -90.0);
31
     }
31
     }
32
 
32
 
33
-    public void test(Double initialBalance, Double witdrawalAmount) {
33
+    public void test(Double initialBalance, Double depositAmount) {
34
         // given
34
         // given
35
-        Double expected = initialBalance + witdrawalAmount;
35
+        Double expected = initialBalance + depositAmount;
36
         BankAccount bankAccount = new BankAccount();
36
         BankAccount bankAccount = new BankAccount();
37
         Transactable transactable = (Transactable)bankAccount;
37
         Transactable transactable = (Transactable)bankAccount;
38
         bankAccount.setBalance(initialBalance);
38
         bankAccount.setBalance(initialBalance);
39
 
39
 
40
         // when
40
         // when
41
-        transactable.deposit(witdrawalAmount);
41
+        transactable.deposit(depositAmount);
42
         Double actual = transactable.getBalance();
42
         Double actual = transactable.getBalance();
43
 
43
 
44
         // then
44
         // then

+ 2
- 2
src/test/java/rocks/zipcode/quiz5/objectorientation/employee/EmployeePolymorphismTest.java View File

24
     }
24
     }
25
 
25
 
26
 
26
 
27
-    @Test
27
+    @Test(expected = ClassCastException.class)
28
     public void test3() {
28
     public void test3() {
29
-        Assert.assertFalse((Account) (Object) employee instanceof Account);
29
+        Account account = (Account) (Object) employee;
30
     }
30
     }
31
 }
31
 }