MemoryTriggerStrategy implements TriggerStrategy { @Override public boolean isToBeTriggered(MRecord values) { T decisionBase = supplier.extract(values); if(decisionBase == null){ return false; } boolean result = isToBeTriggered(decisionBase); lastDecisionBases.add(decisionBase); if(lastDecisionBases.size() > bufferSize){ lastDecisionBases.remove(0); } return result; } MemoryTriggerStrategy(Supplier<T> supplier, int bufferSize, T initialValue); @Override boolean isToBeTriggered(MRecord values); abstract boolean isToBeTriggered(T decisionBase); @Override Set<String> getChannelIdentifiers();  }
@Test public void isToBeTriggered() { assertFalse(strategy.isToBeTriggered(null)); assertFalse(strategy.isToBeTriggered(null)); assertFalse(strategy.isToBeTriggered(null)); assertFalse(strategy.isToBeTriggered(null)); assertTrue(strategy.isToBeTriggered(null)); assertTrue(strategy.isToBeTriggered(null)); assertFalse(clone.isToBeTriggered(null)); }