Skip to content

Instantly share code, notes, and snippets.

@balopat
Created October 30, 2013 04:22
Show Gist options
  • Save balopat/7227184 to your computer and use it in GitHub Desktop.
Save balopat/7227184 to your computer and use it in GitHub Desktop.
package com.balopat.timeinjection
import org.scalatest.FlatSpec
import java.util.Date
import org.scalatest.matchers.ShouldMatchers
class RealClockSpec extends FlatSpec with ShouldMatchers {
"RealClock " should "give back instant between the command before and after" in {
val clock: RealClock = new RealClock()
val timeBefore = new Date()
val realTime = clock.getTime()
val timeAfter = new Date()
realTime.after(timeBefore) || realTime.equals(timeBefore) should equal(true)
realTime.before(timeAfter) || realTime.equals(timeAfter) should equal(true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment