12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
-
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class FizzBuzzTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzzTest
- {
- /**
- * Default constructor for test class FizzBuzzTest
- */
- public FizzBuzzTest(){
- }
-
- @Test
- public void FizzForMultiplesOfThreeButNotFive() {
-
- String expected = "Fizz";
-
- for (int i = 1; i<=100; i++ ) {
- if ((i%3 == 0) && !(i%5==0)) {
- String actual = "Fizz";
- assertEquals(expected, actual);
- }
- }
- }
- @Test
- public void BuzzForMultiplesOfFiveButNotThree() {
-
- String expected = "Buzz";
-
- for (int i = 1; i<=100; i++ ) {
- if ((i%5 == 0) && !(i%3==0)) {
- String actual = "Buzz";
- assertEquals(expected, actual);
- }
- }
- }
- @Test
- public void FizzBuzzForMultiplesOfThreeAndFive() {
-
- String expected = "FizzBuzz";
-
- for (int i = 1; i<=100; i++ ) {
- if ((i%3 == 0) && (i%5==0)) {
- String actual = "FizzBuzz";
- assertEquals(expected, actual);
- }
- }
- }
- }
|