### Question:
EventBuffer implements IEventBuffer { @Override public int drainToCollection(Collection<IRainbowMessage> collection) { return queue.drainTo(collection); } EventBuffer(int size); @Override int drainToCollection(Collection<IRainbowMessage> collection); @Override void add(IRainbowMessage event); @Override void clear(); @Override void activate(); @Override void deactivate(); @Override boolean isActive();  }### Answer:
@Test public void testDrainToCollection() throws RainbowException { System.out.println("drainToCollection"); List<IRainbowMessage> collection = new ArrayList<>(); EventBuffer instance = new EventBuffer(10); instance.activate(); IRainbowMessage event1 = new RainbowESEBMessage(); IRainbowMessage event2 = new RainbowESEBMessage(); event1.setProperty(ESEBConstants.MSG_CHANNEL_KEY, "MODEL_DS"); event2.setProperty(ESEBConstants.MSG_CHANNEL_KEY, "MODEL_US"); instance.add(event1); instance.add(event2); int num = instance.drainToCollection(collection); assertEquals(2, num); IRainbowMessage result1 = collection.get(0); IRainbowMessage result2 = collection.get(1); assertEquals(event1.toString(), result1.toString()); assertEquals(event2.toString(), result2.toString()); }