@Test public void events() { List<Entitlement> ents = new ArrayList<Entitlement>(); ents.add(mock(Entitlement.class)); ents.add(mock(Entitlement.class)); Event evt1 = mock(Event.class); Event evt2 = mock(Event.class); when(ef.entitlementCreated(any(Entitlement.class))).thenReturn(evt1).thenReturn(evt2); entitler.sendEvents(ents); verify(sink).queueEvent(eq(evt1)); verify(sink).queueEvent(eq(evt2)); }
@Test public void noEventsWhenListEmpty() { List<Entitlement> ents = new ArrayList<Entitlement>(); entitler.sendEvents(ents); verify(sink, never()).queueEvent(any(Event.class)); }
@Test public void noEventsWhenEntitlementsNull() { entitler.sendEvents(null); verify(sink, never()).queueEvent(any(Event.class)); }