@Test public void shouldLogResponseFromCoffeeHouse() { new JavaTestKit(system) {{ interceptInfoLogMessage(this, "stub response", 1, () -> { new CoffeeHouseApp(system) { @Override protected ActorRef createCoffeeHouse() { return createStubActor("stub-coffee-house", () -> new AbstractLoggingActor() { @Override public Receive createReceive() { return receiveBuilder().matchAny(o -> getSender().tell("stub response", getSelf())).build(); } }); } }; }); }}; }
private static Props printerProps(ActorRef coffeeHouse) { return Props.create(AbstractLoggingActor.class, () -> new AbstractLoggingActor() { @Override public Receive createReceive() { return receiveBuilder().matchAny(o -> log().info(o.toString())).build(); } { coffeeHouse.tell("Brew Coffee", self()); } }); }
private static Props printerProps(ActorRef coffeeHouse) { return Props.create(AbstractLoggingActor.class, () -> { return new AbstractLoggingActor() { @Override public Receive createReceive() { return receiveBuilder().matchAny(o -> log().info(o.toString())).build(); } { coffeeHouse.tell("Brew Coffee", self()); } }; }); }
private static Props printerProps(ActorRef coffeeHouse) { return Props.create(AbstractLoggingActor.class, () -> new AbstractLoggingActor() { { coffeeHouse.tell("Brew Coffee", self()); receive(ReceiveBuilder. matchAny(o -> log().info(o.toString())).build() ); } }); }
@Test public void shouldLogResponseFromCoffeeHouse() { new JavaTestKit(system) {{ interceptInfoLogMessage(this, "stub response", 1, () -> { new CoffeeHouseApp(system) { @Override protected ActorRef createCoffeeHouse() { return createStubActor("stub-coffee-house", () -> new AbstractLoggingActor() {{ receive(ReceiveBuilder.matchAny(o -> sender().tell("stub response", self())).build()); }}); } }; }); }}; }
private static Props printerProps(ActorRef coffeeHouse) { return Props.create(AbstractLoggingActor.class, () -> new AbstractLoggingActor() { @Override public Receive createReceive() { return receiveBuilder().matchAny(o -> log().info(o.toString())).build(); } { coffeeHouse.tell("Brew Coffee", getSelf()); } }); }