DeltaSessionAttributeEventBatch extends AbstractGatewayDeltaEvent { @Override public void apply(Cache cache) { @SuppressWarnings("unchecked") Region<String, DeltaSessionInterface> region = getRegion(cache); DeltaSessionInterface session = region.get(this.key); if (session == null) { String builder = "Session " + this.key + " was not found while attempting to apply " + this; cache.getLogger().warning(builder); } else { session.applyAttributeEvents(region, this.eventQueue); if (cache.getLogger().fineEnabled()) { cache.getLogger().fine("Applied " + this); } } } @SuppressWarnings("unused")  DeltaSessionAttributeEventBatch();  DeltaSessionAttributeEventBatch(String regionName, String sessionId,
      List<DeltaSessionAttributeEvent> eventQueue); @Override void apply(Cache cache); @Override void fromData(DataInput in); @Override void toData(DataOutput out); String toString();  }
@Test public void TestApplyForBatch() { final List<DeltaSessionAttributeEvent> eventList = new ArrayList<>(); final DeltaSessionAttributeEvent event1 = mock(DeltaSessionAttributeEvent.class); final DeltaSessionAttributeEvent event2 = mock(DeltaSessionAttributeEvent.class); eventList.add(event1); eventList.add(event2); final Cache cache = mock(Cache.class); final Region<String, DeltaSessionInterface> region = mock(Region.class); final DeltaSessionInterface deltaSessionInterface = mock(DeltaSessionInterface.class); doReturn(region).when(cache).getRegion(regionName); when(cache.getLogger()).thenReturn(logWriter); when(logWriter.fineEnabled()).thenReturn(false); when(region.get(sessionId)).thenReturn(deltaSessionInterface); final DeltaSessionAttributeEventBatch batch = new DeltaSessionAttributeEventBatch(regionName, sessionId, eventList); batch.apply(cache); verify(deltaSessionInterface).applyAttributeEvents(region, eventList); }