X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FWebOfTrustPingerTest.kt;h=7ad9c949b6839714cea367c91c4885ae51111d00;hp=894b9ef0a6d6bcf5f62faf3df28056f7d632fd1d;hb=2f1e414e86c61435cd8b3991c475e0832f6de2fb;hpb=ceac45f8b8a241e8f9809d70eeda7897f5e280b7 diff --git a/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustPingerTest.kt b/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustPingerTest.kt index 894b9ef..7ad9c94 100644 --- a/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustPingerTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustPingerTest.kt @@ -1,5 +1,5 @@ /** - * Sone - WebOfTrustPinger.kt - Copyright © 2019 David ‘Bombe’ Roden + * Sone - WebOfTrustPingerTest.kt - Copyright © 2019 David ‘Bombe’ Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ import net.pterodactylus.sone.utils.* import org.hamcrest.MatcherAssert.* import org.hamcrest.Matchers.* import java.util.concurrent.atomic.* +import java.util.function.* import kotlin.test.* /** @@ -33,9 +34,9 @@ class WebOfTrustPingerTest { private val eventBus = EventBus() private val webOfTrustReachable = AtomicBoolean() - private val webOfTrustReacher: () -> Unit = { webOfTrustReachable.get().onFalse { throw PluginException() } } + private val webOfTrustReacher = Runnable { webOfTrustReachable.get().onFalse { throw PluginException() } } private val rescheduled = AtomicBoolean() - private val reschedule: () -> Unit = { rescheduled.set(true) } + private val reschedule: Consumer = Consumer { if (it == pinger) rescheduled.set(true) } private val pinger = WebOfTrustPinger(eventBus, webOfTrustReacher, reschedule) @Test @@ -104,14 +105,14 @@ class WebOfTrustPingerTest { private class WebOfTrustAppearedCatcher(private val received: () -> Unit) { @Subscribe - fun webOfTrustAppeared(webOfTrustAppeared: WebOfTrustAppeared) { + fun webOfTrustAppeared(@Suppress("UNUSED_PARAMETER") webOfTrustAppeared: WebOfTrustAppeared) { received() } } private class WebOfTrustDisappearedCatcher(private val received: () -> Unit) { @Subscribe - fun webOfTrustDisappeared(webOfTrustDisappeared: WebOfTrustDisappeared) { + fun webOfTrustDisappeared(@Suppress("UNUSED_PARAMETER") webOfTrustDisappeared: WebOfTrustDisappeared) { received() } }