Last active
August 29, 2015 14:08
-
-
Save up1/b91079d20e4bea95f4b7 to your computer and use it in GitHub Desktop.
TPP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void returnNumberByDefault() { | |
assertEquals("1", FizzBuzz.say(1)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void returnBuzzWhenNumberDivide5() { | |
assertEquals("Buzz", FizzBuzz.say(5)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
if (number % 3 == 0) | |
return "Fizz"; | |
if (number % 5 == 0) | |
return "Buzz"; | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
if (number % 15 == 0) | |
return "FizzBuzz"; | |
if (number % 3 == 0) | |
return "Fizz"; | |
if (number % 5 == 0) | |
return "Buzz"; | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
if (number % 3 == 0) | |
return "Fizz"; | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
int input = 3; | |
String output = "Fizz"; | |
if (number % input == 0) | |
return output; | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
int[] input = { 3, 5 }; | |
String[] output = { "Fizz", "Buzz" }; | |
if (number % input[0] == 0) | |
return output[0]; | |
if (number % input[1] == 0) | |
return output[1]; | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
int[] input = { 3, 5 }; | |
String[] output = { "Fizz", "Buzz" }; | |
for (int i = 0; i < input.length; i++) { | |
if (number % input[i] == 0) | |
return output[i]; | |
} | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
static int[] input = { 15, 3, 5 }; | |
static String[] output = { "FizzBuzz", "Fizz", "Buzz" }; | |
public static String say(Integer number) { | |
for (int i = 0; i < input.length; i++) { | |
if (number % input[i] == 0) | |
return output[i]; | |
} | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(int number) { | |
return null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(int number) { | |
return "1"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void returnNumberByDefault() { | |
assertEquals("1", FizzBuzz.say(1)); | |
assertEquals("2", FizzBuzz.say(2)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void returnFizzWhenNumberDivide3() { | |
assertEquals("Fizz", FizzBuzz.say(3)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
if(number == 3) | |
return "Fizz"; | |
return number.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void returnFizzWhenNumberDivide3() { | |
assertEquals("Fizz", FizzBuzz.say(3)); | |
assertEquals("Fizz", FizzBuzz.say(6)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FizzBuzz { | |
public static String say(Integer number) { | |
if (number % 3 == 0) | |
return "Fizz"; | |
return number.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment