Last active
June 18, 2019 13:44
-
-
Save vanessagl2/c0c3cfc69ff561184701da881d6f84b4 to your computer and use it in GitHub Desktop.
Build Gradle base java junit code
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
Given a number, the program should: | |
Return "Fizz" if the number is a multiple of 3; | |
Return "Buzz" if the number is a multiple of 5; | |
Return "FizzBuzz" if the number is a multiple of both. | |
Return the same number if the number is not a multiple of one of them or both; | |
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
import fizzbuzz.FizzBuzz; | |
import org.junit.Test; | |
import static org.hamcrest.core.Is.is; | |
import static org.junit.Assert.assertThat; | |
public class FizzBuzzTest { | |
@Test | |
public void shouldReturnFizzWhenNumberIsMultipleOf3() { | |
int number = 3; | |
FizzBuzz fizzBuzz = new FizzBuzz(); | |
String convertedNumber = fizzBuzz.convert(number); | |
assertThat(convertedNumber, is("fizz")); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment