Skip to content

Commit 2aa65fb

Browse files
committed
added new recipe FizzBuzzGoldenMaster w/ @samanthalangit
1 parent 34c8d45 commit 2aa65fb

4 files changed

Lines changed: 33 additions & 9 deletions

File tree

src/main/java/org/teachingkidsprogramming/recipes/completed/section09final/FizzBuzzGoldenMaster.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ public class FizzBuzzGoldenMaster
88
@Test
99
public void testNumbers() throws Exception
1010
{
11-
// Arrange - create a list of numbers from 1-100
11+
// ARRANGE - Create a list of numbers from 1-100
1212
StringBuilder sb = new StringBuilder();
1313
for (int i = 1; i < 101; i++)
1414
{
15-
// Act - call the convertNumbers method on the list
15+
// ACT - Call the convertNumbers method on the list
1616
sb.append(convert(i));
1717
}
18-
// IMPORTANT - This testing method uses a file compare tool
19-
// You could use 'BeyondCompare' for this
20-
// Download from -- http://www.scootersoftware.com/download.php
21-
//
22-
// Assert that the list is a Golden Master (uses .received and .approved files)
18+
// DOWNLOAD 'BeyondCompare' - http://www.scootersoftware.com/download.php
19+
// VERIFY that the list is as a Golden Master using Approvals (uses .received and .approved files)
2320
Approvals.verify(sb);
2421
}
2522
public static String convert(int i)

src/main/java/org/teachingkidsprogramming/section09final/FizzBuzz.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class FizzBuzz
44
{
5-
// For the whole numbers from 1 to 100, print either that number, or,
5+
// For the whole numbers from 1 to 100, print either that number, or,
66
// If that number is evenly divisible by 3, then print the word 'Fizz',
77
// If that number is evenly divisible by 5, then print the word 'Buzz',
88
// If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.teachingkidsprogramming.section09final;
2+
3+
import org.junit.Test;
4+
import org.teachingextensions.approvals.lite.Approvals;
5+
6+
public class FizzBuzzGoldenMaster
7+
{
8+
// Write a test using the GoldenMaster method via the TDD style for the convert method
9+
// IMPORTANT - GoldenMaster testing requires the use a of file compare tool
10+
// Download 'BeyondCompare' -- http://www.scootersoftware.com/download.php
11+
@Test
12+
public void testNumbers() throws Exception
13+
{
14+
// Arrange Create a list of numbers from 1-100
15+
// Act Call the convert method on the list
16+
// Verify The list is a Golden Master (uses .received and .approved files)
17+
Approvals.verify("1");
18+
}
19+
public static String convert(int i)
20+
{
21+
// For the whole numbers from 1 to 100, print either that number, or,
22+
// If that number is evenly divisible by 3, then print the word 'Fizz',
23+
// If that number is evenly divisible by 5, then print the word 'Buzz',
24+
// If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
25+
return "";
26+
}
27+
}

src/main/java/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class FizzBuzzTDD
44
{
5-
// For the numbers being tested, print out either that number, or,
5+
// For the numbers being tested, print out either that number, or,
66
// If that number is evenly divisible by 3, then print the word 'Fizz',
77
// If that number is evenly divisible by 5, then print the word 'Buzz',
88
// If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'

0 commit comments

Comments
 (0)