summaryrefslogtreecommitdiff
path: root/odcsim-testkit/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2019-05-08 11:42:05 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2019-05-14 12:55:56 +0200
commit1f77d1011577c54e98ad0cbbd898817f98000881 (patch)
tree8ee70617f9fa7234f7b78d5056e59677979adc5e /odcsim-testkit/src
parent791aa01938aef966ff3c0f2cd31d2aebdccddb6f (diff)
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.
Diffstat (limited to 'odcsim-testkit/src')
-rw-r--r--odcsim-testkit/src/main/kotlin/com/atlarge/odcsim/testkit/internal/ActorContextStub.kt5
1 files changed, 5 insertions, 0 deletions
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<T : Any>(private val owner: BehaviorTestKitImpl<
return btk.ref
}
+ override fun <U : Any> spawnAnonymous(behavior: Behavior<U>): ActorRef<U> {
+ 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