Merge pull request #28099 from pabloazul/rename-unnecessarily-gendered-references

Rename Father -> Parent
This commit is contained in:
Patrik Nordwall 2019-10-31 14:26:26 +01:00 committed by GitHub
commit 53723c01d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

View file

@ -9,15 +9,15 @@ import akka.actor.typed.scaladsl.Behaviors
import akka.actor.typed.{ ActorRef, Behavior, Props } import akka.actor.typed.{ ActorRef, Behavior, Props }
import akka.actor.testkit.typed.{ CapturedLogEvent, Effect } import akka.actor.testkit.typed.{ CapturedLogEvent, Effect }
import akka.actor.testkit.typed.Effect._ import akka.actor.testkit.typed.Effect._
import akka.actor.testkit.typed.scaladsl.BehaviorTestKitSpec.{ Child, Father } import akka.actor.testkit.typed.scaladsl.BehaviorTestKitSpec.{ Child, Parent }
import akka.actor.testkit.typed.scaladsl.BehaviorTestKitSpec.Father._ import akka.actor.testkit.typed.scaladsl.BehaviorTestKitSpec.Parent._
import org.scalatest.{ Matchers, WordSpec } import org.scalatest.{ Matchers, WordSpec }
import scala.reflect.ClassTag import scala.reflect.ClassTag
import org.slf4j.event.Level import org.slf4j.event.Level
object BehaviorTestKitSpec { object BehaviorTestKitSpec {
object Father { object Parent {
case class Reproduce(times: Int) case class Reproduce(times: Int)
@ -128,31 +128,31 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestKit" must { "BehaviorTestKit" must {
"allow assertions on effect type" in { "allow assertions on effect type" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnAnonymous(1)) testkit.run(SpawnAnonymous(1))
val spawnAnonymous = testkit.expectEffectType[Effect.SpawnedAnonymous[_]] val spawnAnonymous = testkit.expectEffectType[Effect.SpawnedAnonymous[_]]
spawnAnonymous.props should ===(Props.empty) spawnAnonymous.props should ===(Props.empty)
} }
"allow expecting NoEffects by type" in { "allow expecting NoEffects by type" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.expectEffectType[NoEffects] testkit.expectEffectType[NoEffects]
} }
"allow expecting NoEffects" in { "allow expecting NoEffects" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.expectEffect(NoEffects) testkit.expectEffect(NoEffects)
} }
"return if effects have taken place" in { "return if effects have taken place" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.hasEffects() should ===(false) testkit.hasEffects() should ===(false)
testkit.run(SpawnAnonymous(1)) testkit.run(SpawnAnonymous(1))
testkit.hasEffects() should ===(true) testkit.hasEffects() should ===(true)
} }
"allow assertions using partial functions - no match" in { "allow assertions using partial functions - no match" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnChildren(1)) testkit.run(SpawnChildren(1))
val ae = intercept[AssertionError] { val ae = intercept[AssertionError] {
testkit.expectEffectPF { testkit.expectEffectPF {
@ -163,7 +163,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
} }
"allow assertions using partial functions - match" in { "allow assertions using partial functions - match" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnChildren(1)) testkit.run(SpawnChildren(1))
val childName = testkit.expectEffectPF { val childName = testkit.expectEffectPF {
case Spawned(_, name, _) => name case Spawned(_, name, _) => name
@ -172,7 +172,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
} }
"allow assertions using partial functions - match on NoEffect" in { "allow assertions using partial functions - match on NoEffect" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
val hasEffects = testkit.expectEffectPF { val hasEffects = testkit.expectEffectPF {
case NoEffects => false case NoEffects => false
} }
@ -181,14 +181,14 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"allow retrieving log messages issued by behavior" in { "allow retrieving log messages issued by behavior" in {
val what = "Hello!" val what = "Hello!"
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(Log(what)) testkit.run(Log(what))
testkit.logEntries() shouldBe Seq(CapturedLogEvent(Level.INFO, what)) testkit.logEntries() shouldBe Seq(CapturedLogEvent(Level.INFO, what))
} }
"allow clearing log messages issued by behavior" in { "allow clearing log messages issued by behavior" in {
val what = "Hi!" val what = "Hi!"
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(Log(what)) testkit.run(Log(what))
testkit.logEntries() shouldBe Seq(CapturedLogEvent(Level.INFO, what)) testkit.logEntries() shouldBe Seq(CapturedLogEvent(Level.INFO, what))
testkit.clearLog() testkit.clearLog()
@ -198,14 +198,14 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestKit's spawn" must { "BehaviorTestKit's spawn" must {
"create children when no props specified" in { "create children when no props specified" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnChildren(2)) testkit.run(SpawnChildren(2))
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
effects should contain only (Spawned(Child.initial, "child0"), Spawned(Child.initial, "child1", Props.empty)) effects should contain only (Spawned(Child.initial, "child0"), Spawned(Child.initial, "child1", Props.empty))
} }
"create children when props specified and record effects" in { "create children when props specified and record effects" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnChildrenWithProps(2, props)) testkit.run(SpawnChildrenWithProps(2, props))
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
effects should contain only (Spawned(Child.initial, "child0", props), Spawned(Child.initial, "child1", props)) effects should contain only (Spawned(Child.initial, "child0", props), Spawned(Child.initial, "child1", props))
@ -214,14 +214,14 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestkit's spawnAnonymous" must { "BehaviorTestkit's spawnAnonymous" must {
"create children when no props specified and record effects" in { "create children when no props specified and record effects" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnAnonymous(2)) testkit.run(SpawnAnonymous(2))
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
effects shouldBe Seq(SpawnedAnonymous(Child.initial, Props.empty), SpawnedAnonymous(Child.initial, Props.empty)) effects shouldBe Seq(SpawnedAnonymous(Child.initial, Props.empty), SpawnedAnonymous(Child.initial, Props.empty))
} }
"create children when props specified and record effects" in { "create children when props specified and record effects" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnAnonymousWithProps(2, props)) testkit.run(SpawnAnonymousWithProps(2, props))
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
@ -231,14 +231,14 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestkit's spawnMessageAdapter" must { "BehaviorTestkit's spawnMessageAdapter" must {
"create adapters without name and record effects" in { "create adapters without name and record effects" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnAdapter) testkit.run(SpawnAdapter)
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
effects shouldBe Seq(SpawnedAnonymousAdapter()) effects shouldBe Seq(SpawnedAnonymousAdapter())
} }
"create adapters with name and record effects" in { "create adapters with name and record effects" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnAdapterWithName("adapter")) testkit.run(SpawnAdapterWithName("adapter"))
val effects = testkit.retrieveAllEffects() val effects = testkit.retrieveAllEffects()
effects shouldBe Seq(SpawnedAdapter("adapter")) effects shouldBe Seq(SpawnedAdapter("adapter"))
@ -247,7 +247,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestkit's messageAdapter" must { "BehaviorTestkit's messageAdapter" must {
"create message adapters and record effects" in { "create message adapters and record effects" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(CreateMessageAdapter(classOf[String], (_: String) => SpawnChildren(1))) testkit.run(CreateMessageAdapter(classOf[String], (_: String) => SpawnChildren(1)))
testkit.expectEffectType[MessageAdapter[String, Command]] testkit.expectEffectType[MessageAdapter[String, Command]]
} }
@ -255,7 +255,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestkit's run".can { "BehaviorTestkit's run".can {
"run behaviors with messages without canonicalization" in { "run behaviors with messages without canonicalization" in {
val testkit = BehaviorTestKit[Father.Command](Father.init) val testkit = BehaviorTestKit[Parent.Command](Parent.init)
testkit.run(SpawnAdapterWithName("adapter")) testkit.run(SpawnAdapterWithName("adapter"))
testkit.currentBehavior should not be Behaviors.same testkit.currentBehavior should not be Behaviors.same
testkit.returnedBehavior shouldBe Behaviors.same testkit.returnedBehavior shouldBe Behaviors.same
@ -264,7 +264,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestKits watch" must { "BehaviorTestKits watch" must {
"record effects for watching and unwatching" in { "record effects for watching and unwatching" in {
val testkit = BehaviorTestKit(Father.init) val testkit = BehaviorTestKit(Parent.init)
testkit.run(SpawnAndWatchUnwatch("hello")) testkit.run(SpawnAndWatchUnwatch("hello"))
val child = testkit.childInbox("hello").ref val child = testkit.childInbox("hello").ref
testkit.retrieveAllEffects() should be( testkit.retrieveAllEffects() should be(
@ -272,7 +272,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
} }
"record effects for watchWith" in { "record effects for watchWith" in {
val testkit = BehaviorTestKit(Father.init) val testkit = BehaviorTestKit(Parent.init)
val spawnAndWatchWithMsg = SpawnAndWatchWith("hello") val spawnAndWatchWithMsg = SpawnAndWatchWith("hello")
testkit.run(spawnAndWatchWithMsg) testkit.run(spawnAndWatchWithMsg)
val child = testkit.childInbox("hello").ref val child = testkit.childInbox("hello").ref
@ -283,7 +283,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
"BehaviorTestKits child actor support" must { "BehaviorTestKits child actor support" must {
"allow retrieving and killing" in { "allow retrieving and killing" in {
val testkit = BehaviorTestKit(Father.init) val testkit = BehaviorTestKit(Parent.init)
val i = TestInbox[ActorRef[String]]() val i = TestInbox[ActorRef[String]]()
val h = TestInbox[String]() val h = TestInbox[String]()
testkit.run(SpawnSession(i.ref, h.ref)) testkit.run(SpawnSession(i.ref, h.ref))
@ -306,7 +306,7 @@ class BehaviorTestKitSpec extends WordSpec with Matchers with LogCapturing {
} }
"stop and restart a named child" in { "stop and restart a named child" in {
val testkit = BehaviorTestKit(Father.init) val testkit = BehaviorTestKit(Parent.init)
testkit.run(SpawnChild) testkit.run(SpawnChild)
val child = testkit.expectEffectType[Spawned[String]] val child = testkit.expectEffectType[Spawned[String]]

View file

@ -179,7 +179,7 @@ trait ActorRefFactory {
implicit def dispatcher: ExecutionContextExecutor implicit def dispatcher: ExecutionContextExecutor
/** /**
* Father of all children created by this interface. * Parent of all children created by this interface.
* *
* INTERNAL API * INTERNAL API
*/ */