parent
9ccf71076a
commit
7edf3bfecf
3 changed files with 95 additions and 0 deletions
|
|
@ -191,6 +191,21 @@ public class ReceiveBuilderTest extends JUnitSuite {
|
|||
assertFalse(rcv.onMessage().isDefinedAt(42));
|
||||
}
|
||||
|
||||
private boolean externalPredicateAlwaysTrue(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldMatchByExternalPredicate(){
|
||||
Receive rcv = ReceiveBuilder.create()
|
||||
.match(Msg1.class, this::externalPredicateAlwaysTrue, m -> result("match Msg1"))
|
||||
.build();
|
||||
assertTrue(rcv.onMessage().isDefinedAt(new Msg1()));
|
||||
rcv.onMessage().apply(new Msg1());
|
||||
assertEquals("match Msg1", result());
|
||||
assertFalse(rcv.onMessage().isDefinedAt(new Msg2("foo")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldMatchEquals() {
|
||||
Msg2 msg2 = new Msg2("foo");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue