Fizz-Buzz generator using test driven development

Photo by Kevin Grieve on Unsplash

This is a Fizz Buzz generator using test driven development.

Problem statement:

The Fizz buzz generator is a simple program, it’s method say generate accepts the numeric input and produces the output string based on the rules and input number.

Rules

The generate method returns the string

  • FizzBuzz when input parameter is divisible by 3 and 5.
  • Fizz when input parameter is divisible by 3.
  • Buzz when input parameter is divisible by 5.
  • String representation of given number when input parameter neither divisible by 3 or 5.

It is clear that there are four use cases to implement

  • FizzBuzz As a fizz buzz generator, I should be able to generate a string FizzBuzz for a given input number when the number is divisible by 3 and 5.
  • Fizz As a fizz buzz generator, I should be able to generate a string Fizz for a given input number when the number is divisible by 3.
  • Buzz As a fizz buzz generator, I should be able to generate a string Buzz for a given input number when the number is divisible by 5.
  • Number (converted to stringAs a fizz buzz generator, I should be able to generate a string format of input number for a given input number when number is neither divisible by 3 or 5.

Visit the github repository fizz-buzz-generator for TDD implementation.

Don’t forget to go through commit by commit to witness the test driven development journey.