From 1f77d1011577c54e98ad0cbbd898817f98000881 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 8 May 2019 11:42:05 +0200 Subject: feat: Add support for spawning anonymous children This change adds support for spawning anonymous children in an ActorContext. This means a name does not have to be specified when spawning an actor. --- .../kotlin/com/atlarge/odcsim/testkit/internal/ActorContextStub.kt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'odcsim-testkit/src') diff --git a/odcsim-testkit/src/main/kotlin/com/atlarge/odcsim/testkit/internal/ActorContextStub.kt b/odcsim-testkit/src/main/kotlin/com/atlarge/odcsim/testkit/internal/ActorContextStub.kt index 047e4c70..7035b908 100644 --- a/odcsim-testkit/src/main/kotlin/com/atlarge/odcsim/testkit/internal/ActorContextStub.kt +++ b/odcsim-testkit/src/main/kotlin/com/atlarge/odcsim/testkit/internal/ActorContextStub.kt @@ -32,6 +32,7 @@ import com.atlarge.odcsim.Duration import com.atlarge.odcsim.Instant import com.atlarge.odcsim.internal.logging.LoggerImpl import org.slf4j.Logger +import java.util.UUID /** * A stubbed [ActorContext] implementation for synchronous behavior testing. @@ -72,6 +73,10 @@ internal class ActorContextStub(private val owner: BehaviorTestKitImpl< return btk.ref } + override fun spawnAnonymous(behavior: Behavior): ActorRef { + return spawn(behavior, "$" + UUID.randomUUID()) + } + override fun stop(child: ActorRef<*>): Boolean { if (child.path.parent != self.path) { // This is not a child of this actor -- cgit v1.2.3