Created
March 29, 2010 20:43
-
-
Save agemooij/348385 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 org.scalatest.FlatSpec | |
import org.scalatest.matchers.ShouldMatchers | |
class StackSpec extends FlatSpec with ShouldMatchers { | |
"A Stack" should "pop values in last-in-first-out order" in { | |
val stack = new Stack[Int] | |
stack.push(1) | |
stack.push(2) | |
stack.pop() should equal (2) | |
stack.pop() should equal (1) | |
} | |
it should "throw NoSuchElementException if an empty stack is popped" in { | |
val emptyStack = new Stack[String] | |
evaluating { emptyStack.pop() } should produce [NoSuchElementException] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment