summaryrefslogtreecommitdiff
path: root/odcsim-core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'odcsim-core/src/test')
-rw-r--r--odcsim-core/src/test/kotlin/com/atlarge/odcsim/ActorSystemTest.kt19
1 files changed, 18 insertions, 1 deletions
diff --git a/odcsim-core/src/test/kotlin/com/atlarge/odcsim/ActorSystemTest.kt b/odcsim-core/src/test/kotlin/com/atlarge/odcsim/ActorSystemTest.kt
index 73b060b9..492dc686 100644
--- a/odcsim-core/src/test/kotlin/com/atlarge/odcsim/ActorSystemTest.kt
+++ b/odcsim-core/src/test/kotlin/com/atlarge/odcsim/ActorSystemTest.kt
@@ -250,7 +250,6 @@ abstract class ActorSystemTest {
Behavior.ignore()
}, "child")
-
Behavior.receive { ctx2, msg ->
assertTrue(ctx2.stop(child))
msg.send(Unit) // This actor should be stopped now and not receive the message anymore
@@ -332,5 +331,23 @@ abstract class ActorSystemTest {
val system = factory(Behavior.stopped<Unit>(), "test")
system.run()
}
+
+ /**
+ * Test whether deferred behavior that returns [Behavior.Companion.same] fails.
+ */
+ @Test
+ fun `should not allow setup to return same`() {
+ val system = factory(Behavior.setup<Unit> { Behavior.same() }, "test")
+ assertThrows<IllegalArgumentException> { system.run() }
+ }
+
+ /**
+ * Test whether deferred behavior that returns [Behavior.Companion.unhandled] fails.
+ */
+ @Test
+ fun `should not allow setup to return unhandled`() {
+ val system = factory(Behavior.setup<Unit> { Behavior.unhandled() }, "test")
+ assertThrows<IllegalArgumentException> { system.run() }
+ }
}
}