Skip to content

Commit

Permalink
Verify requirement check for VirtualTime#advance()
Browse files Browse the repository at this point in the history
  • Loading branch information
miguno committed May 22, 2015
1 parent f6581af commit 488224c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/scala/com/miguno/akka/testing/VirtualTimeSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ class VirtualTimeSpec extends FunSpec with Matchers with GivenWhenThen {
time.elapsed should be(1234.millis)
}

it("should not accept a step that is less than 1 millisecond") {
Given("a time")
val time = new VirtualTime

When("I attempt to advance the time by less than 1 millisecond")
Then("this fails with an exception")
an [IllegalArgumentException] should be thrownBy time.advance(0.millis)
an [IllegalArgumentException] should be thrownBy time.advance(1.microsecond)
an [IllegalArgumentException] should be thrownBy time.advance(999.microsecond)
}

it("should have a meaningful string representation") {
Given("a time")
val time = new VirtualTime
Expand Down

0 comments on commit 488224c

Please sign in to comment.