#36 KrisBlassingame

Open
KrisBlassingame wants to merge 1 commits from KrisBlassingame/FizzBuzz-TDD:master into master
6 changed files with 80 additions and 0 deletions
  1. BIN
      FizzBuzz.class
  2. 5
    0
      FizzBuzz.ctxt
  3. 17
    0
      FizzBuzz.java
  4. BIN
      FizzBuzzTest.class
  5. 11
    0
      FizzBuzzTest.ctxt
  6. 47
    0
      FizzBuzzTest.java

BIN
FizzBuzz.class View File


+ 5
- 0
FizzBuzz.ctxt View File

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=FizzBuzz
3
+comment1.params=num
4
+comment1.target=java.lang.String\ fizzBuzz(int)
5
+numComments=2

+ 17
- 0
FizzBuzz.java View File

@@ -0,0 +1,17 @@
1
+public class FizzBuzz{
2
+    public String fizzBuzz(int num){
3
+        if (num % 3 == 0 && num % 5 == 0) {
4
+            return "fizzbuzz";
5
+        }
6
+
7
+        if (num % 3 == 0) {
8
+            return "fizz";
9
+        }
10
+
11
+        else if (num % 5 == 0) {
12
+            return "buzz";
13
+        }
14
+        return "" + num;
15
+
16
+    }
17
+}

BIN
FizzBuzzTest.class View File


+ 11
- 0
FizzBuzzTest.ctxt View File

@@ -0,0 +1,11 @@
1
+#BlueJ class context
2
+comment0.target=FizzBuzzTest
3
+comment1.params=
4
+comment1.target=void\ FizzBuzzTest1()
5
+comment2.params=
6
+comment2.target=void\ FizzBuzzTest3()
7
+comment3.params=
8
+comment3.target=void\ FizzBuzzTest5()
9
+comment4.params=
10
+comment4.target=void\ FizzBuzzTest15()
11
+numComments=5

+ 47
- 0
FizzBuzzTest.java View File

@@ -0,0 +1,47 @@
1
+import static org.junit.Assert.*;
2
+import org.junit.After;
3
+import org.junit.Before;
4
+import org.junit.Test;
5
+
6
+public class FizzBuzzTest
7
+{
8
+    @Test
9
+    public void FizzBuzzTest1(){
10
+        FizzBuzz fb = new FizzBuzz();
11
+        
12
+        String expected = "1";
13
+        String actual = fb.fizzBuzz(1);   
14
+        
15
+        assertEquals(expected, actual);        
16
+    }
17
+    
18
+    @Test
19
+    public void FizzBuzzTest3(){
20
+        FizzBuzz fb = new FizzBuzz();
21
+        
22
+        String expected = "fizz";
23
+        String actual = fb.fizzBuzz(3);   
24
+        
25
+        assertEquals(expected, actual);        
26
+    }
27
+    
28
+    @Test
29
+    public void FizzBuzzTest5(){
30
+        FizzBuzz fb = new FizzBuzz();
31
+        
32
+        String expected = "buzz";
33
+        String actual = fb.fizzBuzz(5);   
34
+        
35
+        assertEquals(expected, actual);        
36
+    }
37
+    
38
+    @Test
39
+    public void FizzBuzzTest15(){
40
+        FizzBuzz fb = new FizzBuzz();
41
+        
42
+        String expected = "fizzbuzz";
43
+        String actual = fb.fizzBuzz(15);   
44
+        
45
+        assertEquals(expected, actual);        
46
+    }
47
+}