BlackJack 8 년 전
부모
커밋
94c0b445ea
6개의 변경된 파일169개의 추가작업 그리고 0개의 파일을 삭제
  1. BIN
      fizzBuzz.class
  2. 10
    0
      fizzBuzz.ctxt
  3. 43
    0
      fizzBuzz.java
  4. BIN
      fizzBuzzTest.class
  5. 21
    0
      fizzBuzzTest.ctxt
  6. 95
    0
      fizzBuzzTest.java

BIN
fizzBuzz.class 파일 보기


+ 10
- 0
fizzBuzz.ctxt 파일 보기

@@ -0,0 +1,10 @@
1
+#BlueJ class context
2
+comment0.target=fizzBuzz
3
+comment0.text=\n\ Write\ a\ description\ of\ class\ fizzBuzz\ here.\n\n\ @author\ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=
5
+comment1.target=fizzBuzz()
6
+comment1.text=\n\ Constructor\ for\ objects\ of\ class\ fizzBuzz\n
7
+comment2.params=y
8
+comment2.target=java.lang.String\ fizzBuzz(int)
9
+comment2.text=\n\ An\ example\ of\ a\ method\ -\ replace\ this\ comment\ with\ your\ own\n\n\ @param\ \ y\ \ a\ sample\ parameter\ for\ a\ method\n\ @return\ \ \ \ the\ sum\ of\ x\ and\ y\n
10
+numComments=3

+ 43
- 0
fizzBuzz.java 파일 보기

@@ -0,0 +1,43 @@
1
+
2
+/**
3
+ * Write a description of class fizzBuzz here.
4
+ *
5
+ * @author (your name)
6
+ * @version (a version number or a date)
7
+ */
8
+public class fizzBuzz
9
+{
10
+
11
+    /**
12
+     * Constructor for objects of class fizzBuzz
13
+     */
14
+    public fizzBuzz()
15
+    {
16
+
17
+    }
18
+
19
+    /**
20
+     * An example of a method - replace this comment with your own
21
+     *
22
+     * @param  y  a sample parameter for a method
23
+     * @return    the sum of x and y
24
+     */
25
+    public String fizzBuzz(int y)
26
+    {
27
+        String result ="";
28
+        if (y % 5 == 0 && y % 3 == 0){
29
+            result = "fizzBuzz";
30
+        }else if (y % 3 == 0){
31
+            result = "fizz";
32
+        }else if (y % 5 == 0){
33
+            result = "buzz";
34
+        }else{ 
35
+        
36
+            
37
+            result = Integer.toString(y);
38
+        }
39
+
40
+        return result;
41
+    }
42
+
43
+}

BIN
fizzBuzzTest.class 파일 보기


+ 21
- 0
fizzBuzzTest.ctxt 파일 보기

@@ -0,0 +1,21 @@
1
+#BlueJ class context
2
+comment0.target=fizzBuzzTest
3
+comment0.text=\n\ The\ test\ class\ fizzBuzzTest.\n\n\ @author\ \ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=
5
+comment1.target=fizzBuzzTest()
6
+comment1.text=\n\ Default\ constructor\ for\ test\ class\ fizzBuzzTest\n
7
+comment2.params=
8
+comment2.target=void\ setUp()
9
+comment2.text=\n\ Sets\ up\ the\ test\ fixture.\n\n\ Called\ before\ every\ test\ case\ method.\n
10
+comment3.params=
11
+comment3.target=void\ tearDown()
12
+comment3.text=\n\ Tears\ down\ the\ test\ fixture.\n\n\ Called\ after\ every\ test\ case\ method.\n
13
+comment4.params=
14
+comment4.target=void\ fizz1()
15
+comment5.params=
16
+comment5.target=void\ fizz2()
17
+comment6.params=
18
+comment6.target=void\ fizz3()
19
+comment7.params=
20
+comment7.target=void\ fizz4()
21
+numComments=8

+ 95
- 0
fizzBuzzTest.java 파일 보기

@@ -0,0 +1,95 @@
1
+
2
+
3
+import static org.junit.Assert.*;
4
+import org.junit.After;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+/**
9
+ * The test class fizzBuzzTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class fizzBuzzTest
15
+{
16
+    fizzBuzz fiBu = new fizzBuzz();
17
+    /**
18
+     * Default constructor for test class fizzBuzzTest
19
+     */
20
+    public fizzBuzzTest()
21
+    {
22
+    }
23
+
24
+    /**
25
+     * Sets up the test fixture.
26
+     *
27
+     * Called before every test case method.
28
+     */
29
+    @Before
30
+    public void setUp()
31
+    {
32
+    }
33
+
34
+    /**
35
+     * Tears down the test fixture.
36
+     *
37
+     * Called after every test case method.
38
+     */
39
+    @After
40
+    public void tearDown()
41
+    {
42
+    }
43
+    
44
+    @Test
45
+    
46
+    public void fizz1(){
47
+  int x = 2;
48
+    
49
+    String actual = fiBu.fizzBuzz(x);
50
+    
51
+    String expected = "2";
52
+    
53
+    assertEquals(expected, actual);
54
+    
55
+    }
56
+    
57
+    @Test
58
+ 
59
+    public void fizz2(){
60
+   int x = 3;
61
+    
62
+  String actual = fiBu.fizzBuzz(x);
63
+    
64
+   String expected = "fizz";
65
+    
66
+   assertEquals(expected, actual);
67
+    
68
+    }
69
+    
70
+    @Test
71
+ 
72
+    public void fizz3(){
73
+   int x = 5;
74
+    
75
+  String actual = fiBu.fizzBuzz(x);
76
+    
77
+   String expected = "buzz";
78
+    
79
+   assertEquals(expected, actual);
80
+    
81
+    }
82
+    
83
+    @Test
84
+ 
85
+    public void fizz4(){
86
+   int x = 15;
87
+    
88
+  String actual = fiBu.fizzBuzz(x);
89
+    
90
+   String expected = "fizzBuzz";
91
+    
92
+   assertEquals(expected, actual);
93
+    
94
+    }
95
+}