From 2f84b140b82380ec6c1d8a51908fb99b412bc9d9 Mon Sep 17 00:00:00 2001 From: uniumuniu Date: Wed, 11 Oct 2023 12:24:58 +0200 Subject: [PATCH] Change method name from invoke to emit --- src/main/kotlin/com/featurevisor/sdk/Emitter.kt | 2 +- src/test/kotlin/com/featurevisor/sdk/EmitterTest.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/featurevisor/sdk/Emitter.kt b/src/main/kotlin/com/featurevisor/sdk/Emitter.kt index 24bd5a4..8affa92 100644 --- a/src/main/kotlin/com/featurevisor/sdk/Emitter.kt +++ b/src/main/kotlin/com/featurevisor/sdk/Emitter.kt @@ -17,7 +17,7 @@ class Emitter { listeners.clear() } - operator fun invoke(event: EventName) { + fun emit(event: EventName) { listeners.getOrDefault(event, null)?.invoke() } } diff --git a/src/test/kotlin/com/featurevisor/sdk/EmitterTest.kt b/src/test/kotlin/com/featurevisor/sdk/EmitterTest.kt index 0ecdb8d..93c05f7 100644 --- a/src/test/kotlin/com/featurevisor/sdk/EmitterTest.kt +++ b/src/test/kotlin/com/featurevisor/sdk/EmitterTest.kt @@ -35,7 +35,7 @@ class EmitterTest { systemUnderTest.addListener(ACTIVATION, activationCallback) values().forEach { - systemUnderTest.invoke(it) + systemUnderTest.emit(it) } verify(exactly = 1) { @@ -54,7 +54,7 @@ class EmitterTest { systemUnderTest.removeListener(REFRESH) values().forEach { - systemUnderTest.invoke(it) + systemUnderTest.emit(it) } verify(exactly = 1) { @@ -75,7 +75,7 @@ class EmitterTest { systemUnderTest.removeAllListeners() values().forEach { - systemUnderTest.invoke(it) + systemUnderTest.emit(it) } verify(exactly = 0) {