Skip to content

Instantly share code, notes, and snippets.

@jezinka

jezinka/SensorTest.groovy Secret

Last active Aug 29, 2018
Embed
What would you like to do?
@Use(TimeCategory)
class SensorTest extends Specification {
@Unroll
def "IsSensorDead #testTimestamp"() {
given:
Sensor sensor = new Sensor(timestamp: testTimestamp.getTime())
when:
boolean isSensorDead = sensor.sensorDead
then:
noExceptionThrown()
assert isSensorDead == isExpectedDead
where:
testTimestamp || isExpectedDead
new Date() || false
10.seconds.ago || false
59.minutes.ago || false
61.minutes.ago || true
1.day.ago || true
10.years.ago || true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment