Hi,

 akka stream TestKit v1.0 does the following on line 221:

/**
 * Expect and return a data element.
 */
def expectNext(): I = probe.expectMsgType[OnNext[I]].element


And akka stream TestKit v2.0.(1) does the following on line 253:

/**
 * Expect and return a stream element.
 */
def expectNext(): I = probe.receiveOne(probe.remaining) match {
  case OnNext(elem) ⇒ elem.asInstanceOf[I]
  case other        ⇒ throw new AssertionError("expected OnNext, found " + 
other)
}


akka stream v2.0.(1) breaks the API by calling probe.remaining. Maybe it 
should call probe remainingOrDefault instead?

Regards,

Dennis

Op woensdag 23 december 2015 23:08:42 UTC+1 schreef Konrad Malawski:
>
> This sounds a bit weird... I don't think those changed that much in the 
> move to 2.0.
> Could you make the problem example a gist (gist.github.com or complete 
> snippet in email, ready to copy/paste) I could downlaod and quickly have a 
> look? Thanks in advance!
>
> -- 
> Cheers,
> Konrad 'ktoso’ Malawski
> Akka <http://akka.io> @ Typesafe <http://typesafe.com>
>
> On 23 December 2015 at 22:44:47, Dennis Vriend (dnvr...@gmail.com 
> <javascript:>) wrote:
>
> Hi, I have a question about akka stream. I want to migrate a project from 
> akka 2.3 to 2.4.1 and akka stream 1.0 to 2.0.1 and I must now refactor 
> tests. In the test an akka stream is used with the fluent like DSL in which 
> one can expect messages. , an assertion error will be thrown "`remaining` 
> may not be called outside of `within`"
>
> The only way I can fix this is to refactor the test so that the 
> TestSubscriber will be closed over by the .within(FiniteDuration) method, 
> in which the curried function can do the assertion. This is different from 
> the 1.0 version of akka-stream.
>
>
> Is this the correct way to use the TestSubscriber from now on or am I 
> missing something?
>
> Note: this would break the fluent chain like DSL from akka stream 1.0 in a 
> big way, which would be a shame.
>
>
> Example from the 1.0 syntax:
>
>
> currentPersistenceIds(readJournal)
>
> .request(2)
>
> .expectNextUnOrdered("a", "b")
>
> .expectComplete()
>
>
> Using the code above will give the assertion error on akka stream 2.0.
>
>
> To make it work the code must be:
>
>
> val xx = currentPersistenceIds(readJournal)
>
> .request(2)
>
>
> xx.within(10.seconds) {
>
>   xx.expectNextUnOrdered("a", "b")
>
>   .expectComplete()
>
> }
>
>
> I am sure I am doing something wrong, can someone help me out?
>
>
> Thanks!
>
>
> Dennis
>
>
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: 
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to akka-user+...@googlegroups.com <javascript:>.
> To post to this group, send email to akka...@googlegroups.com 
> <javascript:>.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to