Skip to content

Instantly share code, notes, and snippets.

@kings13y
Created May 28, 2012 10:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kings13y/2818471 to your computer and use it in GitHub Desktop.
Save kings13y/2818471 to your computer and use it in GitHub Desktop.
FizzBuzz Test spec with ScalaTest
package org.scalabound.scatdd.scalatest
import org.junit.runner.RunWith
import org.scalatest.FunSpec
import org.scalatest.junit.JUnitRunner
import org.scalabound.scatdd.FizzBuzz
@RunWith(classOf[JUnitRunner])
class FizzBuzzScalaTest extends FunSpec {
describe("A FizzBuzz processor") {
it("should return 'FizzBuzz' from a mulitple of three and five") { assert(FizzBuzz.eval(15) == "FizzBuzz") }
it("should return 'Fizz' from a multiple of three only") { assert(FizzBuzz.eval(12) == "Fizz") }
it("should return 'Buzz' from a multiple of five only") { assert(FizzBuzz.eval(10) == "Buzz") }
it("should return the stringified input from a non multiple of three or five") { assert(FizzBuzz.eval(11) == "11") }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment