X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneModificationDetectorTest.java;h=e2b34f7f44d76b2605c24786c54ce23e01f02434;hp=cd0133f3eca25880243f3ec40f068934be403c52;hb=1c0a2b5e67dda41e75d2315fd0f6f1cfecf26fa6;hpb=f4a7be456eab249c927d340d478d10a96041c837 diff --git a/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java b/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java index cd0133f..e2b34f7 100644 --- a/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java +++ b/src/test/java/net/pterodactylus/sone/core/SoneModificationDetectorTest.java @@ -8,6 +8,7 @@ import static org.mockito.Mockito.when; import java.util.concurrent.atomic.AtomicInteger; +import net.pterodactylus.sone.core.SoneModificationDetector.LockableFingerprintProvider; import net.pterodactylus.sone.data.Sone; import com.google.common.base.Ticker; @@ -21,14 +22,14 @@ import org.junit.Test; public class SoneModificationDetectorTest { private final Ticker ticker = mock(Ticker.class); - private final Sone sone = mock(Sone.class); - private final Core core = mock(Core.class); private final AtomicInteger insertionDelay = new AtomicInteger(60); private final SoneModificationDetector soneModificationDetector; + private final LockableFingerprintProvider lockableFingerprintProvider = mock(LockableFingerprintProvider.class); public SoneModificationDetectorTest() { - when(sone.getFingerprint()).thenReturn("original"); - soneModificationDetector = new SoneModificationDetector(ticker, core, sone, insertionDelay); + when(lockableFingerprintProvider.getFingerprint()).thenReturn("original"); + when(lockableFingerprintProvider.isLocked()).thenReturn(false); + soneModificationDetector = new SoneModificationDetector(ticker, lockableFingerprintProvider, insertionDelay); } private void modifySone() { @@ -36,7 +37,7 @@ public class SoneModificationDetectorTest { } private void modifySone(String uniqueValue) { - when(sone.getFingerprint()).thenReturn("modified" + uniqueValue); + when(lockableFingerprintProvider.getFingerprint()).thenReturn("modified" + uniqueValue); } private void passTime(int seconds) { @@ -44,16 +45,16 @@ public class SoneModificationDetectorTest { } private void lockSone() { - when(core.isLocked(sone)).thenReturn(true); + when(lockableFingerprintProvider.isLocked()).thenReturn(true); } private void unlockSone() { - when(core.isLocked(sone)).thenReturn(false); + when(lockableFingerprintProvider.isLocked()).thenReturn(false); } @Test public void normalConstructorCanBeCalled() { - new SoneModificationDetector(core, sone, insertionDelay); + new SoneModificationDetector(lockableFingerprintProvider, insertionDelay); } @Test