From: David ‘Bombe’ Roden Date: Tue, 24 Jun 2014 17:57:05 +0000 (+0200) Subject: Add test case for locking and unlocking a Sone. X-Git-Tag: 0.9-rc1^2~3^2~235 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e46a5f6ff2861bd37d515bfb1f8e7241c6ae8618;p=Sone.git Add test case for locking and unlocking a Sone. --- diff --git a/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java b/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java index 388319b..9d1cc59 100644 --- a/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java +++ b/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java @@ -47,6 +47,10 @@ public class SoneModificationDetectorTest { when(core.isLocked(sone)).thenReturn(true); } + private void unlockSone() { + when(core.isLocked(sone)).thenReturn(false); + } + @Test public void sonesStartOutAsNotEligible() { assertThat(soneModificationDetector.isModified(), is(false)); @@ -98,6 +102,20 @@ public class SoneModificationDetectorTest { } @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));