CoffeeHouseApp implements Terminal { protected void createGuest(int count, Coffee coffee, int maxCoffeeCount) { for (int i = 0; i < count; i++) { coffeeHouse.tell(new CoffeeHouse.CreateGuest(coffee, maxCoffeeCount), ActorRef.noSender()); } } CoffeeHouseApp(final ActorSystem system); static void main(final String[] args); static Map<String, String> argsToOpts(final List<String> args); static void applySystemProperties(final Map<String, String> opts); static final Pattern optPattern; }
@Test public void shouldCreateNGuestsBasedOnCount() { new JavaTestKit(system) {{ new CoffeeHouseApp(system) { @Override protected ActorRef createCoffeeHouse() { return getRef(); } }.createGuest(2, new Coffee.Akkaccino(), Integer.MAX_VALUE); expectMsgAllOf(new CoffeeHouse.CreateGuest(new Coffee.Akkaccino(), Integer.MAX_VALUE), new CoffeeHouse.CreateGuest(new Coffee.Akkaccino(), Integer.MAX_VALUE)); }}; }