Skip to content

Commit df5677f

Browse files
committed
working on FizzBuzzGoldenMaster
1 parent dba9ea3 commit df5677f

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.teachingkidsprogramming.recipes.completed.section09final;
2+
3+
import org.junit.Ignore;
4+
import org.junit.Test;
5+
import org.teachingextensions.approvals.lite.Approvals;
6+
7+
//********In Progress************************//
8+
public class FizzBuzzGoldenMaster
9+
{
10+
// Remove this when working - for build process only
11+
@Ignore
12+
@Test
13+
public void testNumbers() throws Exception
14+
{
15+
// Arrange - create a list of numbers from 1-20
16+
Integer[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
17+
// Act - call the convertNumbers method on the list
18+
// Assert that the list is a Golden Master
19+
Approvals.verify(numbers);
20+
}
21+
public static String convertNumbers(Integer[] numbers)
22+
{
23+
for (Integer number : numbers)
24+
{
25+
convert(number);
26+
}
27+
//need to fix or override the ToString here
28+
return ("" + numbers);
29+
}
30+
public static String convert(int i)
31+
{
32+
if (0 == i % 15) { return "\n FizzBuzz"; }
33+
if (0 == i % 5) { return "\n Buzz"; }
34+
if (0 == i % 3) { return "\n Fizz"; }
35+
return "" + i;
36+
}
37+
}

0 commit comments

Comments
 (0)