@Test public void sendingPrepareCoffeeShouldResultInCoffeePreparedResponse() { new JavaTestKit(system) {{ ActorRef barista = system.actorOf(Barista.props(duration("100 milliseconds"))); new Within(duration("50 milliseconds"), duration("1000 milliseconds")) { @Override protected void run() { barista.tell(new Barista.PrepareCoffee(new Coffee.Akkaccino(), system.deadLetters()), getRef()); expectMsgEquals(new Barista.CoffeePrepared(new Coffee.Akkaccino(), system.deadLetters())); } }; }}; }
public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); }
Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } }
Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } private  Barista(FiniteDuration prepareCoffeeDuration); }
Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } private  Barista(FiniteDuration prepareCoffeeDuration); @Override Receive createReceive(); static Props props(FiniteDuration prepareCoffeeDuration); }
Barista extends AbstractLoggingActor { public static Props props(FiniteDuration prepareCoffeeDuration) { return Props.create(Barista.class, () -> new Barista(prepareCoffeeDuration)); } private  Barista(FiniteDuration prepareCoffeeDuration); @Override Receive createReceive(); static Props props(FiniteDuration prepareCoffeeDuration);  }