### Question:
Guest extends AbstractLoggingActor { public static Props props(final ActorRef waiter, final Coffee favoriteCoffee, final FiniteDuration finishCoffeeDuration, final int caffeineLimit){ return Props.create(Guest.class, () -> new Guest(waiter, favoriteCoffee, finishCoffeeDuration, caffeineLimit)); } Guest(ActorRef waiter, Coffee favoriteCoffee, FiniteDuration finishCoffeeDuration, int caffeineLimit); static Props props(final ActorRef waiter, final Coffee favoriteCoffee,
        final FiniteDuration finishCoffeeDuration, final int caffeineLimit); @Override void postStop();  }### Answer:
@Test public void sendingCoffeeServedShouldIncreaseCoffeeCount() { new JavaTestKit(system) {{ ActorRef guest = system.actorOf(Guest.props(system.deadLetters(), new Coffee.Akkaccino(), duration("100 milliseconds"), Integer.MAX_VALUE)); interceptInfoLogMessage(this, ".*[Ee]njoy.*1\\.*", 1, () -> { guest.tell(new Waiter.CoffeeServed(new Coffee.Akkaccino()), ActorRef.noSender()); }); }}; }
@Test public void sendingCoffeeFinishedShouldInExceptionIfCaffeineLimitExceeded() { new JavaTestKit(system) {{ ActorRef guest = system.actorOf(Guest.props(system.deadLetters(), new Coffee.Akkaccino(), duration("100 millis"), -1)); eventFilter(this, Guest.CaffeineException.class, "", 1, () -> { guest.tell(Guest.CoffeeFinished.Instance, ActorRef.noSender()); }); }}; }