I have an actor which receives a map within a message. I would like to check the components of that map.
After looking here Pattern matching on testing expected message, I did this:
testReceiver.expectMsgPF() match {
case SomeMessage(answer) => {
assert(answer.keys.size == 1)
assert(answer.keys.head == "appId")
}
case _ => Failed
}
However, I got this issue:
[error] You can make this conversion explicit by writing `expectMsgPF _` or `expectMsgPF(_,_)(_)` instead of `expectMsgPF`.
[error] testReceiver.expectMsgPF() match {
[error] ^
After that, I changed the first line to:
testReceiver.expectMsgPF _ match {
After that, on the second line I get:
constructor cannot be instantiated to expected type;
[error] found : my.package.SomeMessage
[error] required: (String, String) => PartialFunction[Any,Nothing] => Nothing
I think I'm not approaching this the right way.
How can I extract the map from the message and then check its properties?