when(core.isLocked(sone)).thenReturn(true);
}
+ private void unlockSone() {
+ when(core.isLocked(sone)).thenReturn(false);
+ }
+
@Test
public void sonesStartOutAsNotEligible() {
assertThat(soneModificationDetector.isModified(), is(false));
}
@Test
+ public void lockingAndUnlockingASoneRestartsTheWaitPeriod() {
+ modifySone();
+ lockSone();
+ passTime(30);
+ assertThat(soneModificationDetector.isEligibleForInsert(), is(false));
+ unlockSone();
+ assertThat(soneModificationDetector.isEligibleForInsert(), is(false));
+ passTime(60);
+ assertThat(soneModificationDetector.isEligibleForInsert(), is(false));
+ passTime(90);
+ assertThat(soneModificationDetector.isEligibleForInsert(), is(true));
+ }
+
+ @Test
public void settingFingerprintWillResetTheEligibility() {
modifySone();
assertThat(soneModificationDetector.isEligibleForInsert(), is(false));