你知道为什么这段代码应该在 {implicit session: DBSession => val person1: Person = Person.create(firstname1, lastname1, ssn1, email1, dob1) 中“添加 person s 然后按名字查找”。获取 val person3: Person = Person.create(firstname1, lastname3, ssn3, email3, dob3).get
val publisher1: DatabasePublisher[Person] = Person.findByFirstName(firstname1)
val probe1 = TestSink.probe[Person](actorSystem)
val (_, sink) = Source
.fromPublisher(publisher1)
.toMat(probe1)(Keep.both)
.run()
sink.request(2)
sink.expectNext(person1, person3)
sink.expectComplete()
}
会给出这个错误
2019-09-26 16:28:13,846 INFO s.s.DatabasePublisher@[kka.actor.default-dispatcher-6] - Database stream requested by subscriber: akka.stream.impl.fusing.ActorGraphInterpreter$BatchingActorInputBoundary$$anon$1@17b79df0 is ready
2019-09-26 16:28:13,855 INFO s.s.DatabaseSubscription@[la-execution-context-global-24] - All data for subscriber: akka.stream.impl.fusing.ActorGraphInterpreter$BatchingActorInputBoundary$$anon$1@17b79df0 has been sent
2019-09-26 16:28:13,857 INFO s.s.DatabaseSubscription@[la-execution-context-global-24] - Finished cleaning up database resources occupied for subscriber: akka.stream.impl.fusing.ActorGraphInterpreter$BatchingActorInputBoundary$$anon$1@17b79df0
[ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.683 s <<< FAILURE! - in com.bah.devops.common.entities.PersonTest
[ERROR] Person should add person s and then find-by-firstname(com.bah.devops.common.entities.PersonTest) Time elapsed: 0.144 s <<< FAILURE!
java.lang.AssertionError: assertion failed: expected OnNext(Person(14,FN1,LN1,000-00-0001,1@email.test.com,2019-01-02)), found OnComplete
at com.bah.devops.common.entities.PersonTest.$anonfun$new$22(PersonTest.scala:418)
at com.bah.devops.common.entities.PersonTest.$anonfun$new$22$adapted(PersonTest.scala:284)
at com.bah.devops.common.entities.PersonTest.using(PersonTest.scala:27)
at com.bah.devops.common.entities.PersonTest.withFixture(PersonTest.scala:27)
? 我不知道为什么这两个onNext
电话似乎错过了。