DefaultAlertEntityHolder implements AlertEntityHolder { @Override public List<AlertEntity> allAlerts() { return Lists.newArrayList(alerts); } DefaultAlertEntityHolder(ALERT_TYPE alertType); @Override ALERT_TYPE getAlertType(); @Override synchronized void hold(AlertEntity alertEntity); @Override boolean remove(AlertEntity alertEntity); @Override synchronized void removeIf(Predicate<AlertEntity> predicate); @Override synchronized boolean hasAlerts(); @Override List<AlertEntity> allAlerts(); @Override String toString();  }
@Test public void allAlerts() { int N = 10; for(int i = 0; i < N; i++) { holder.hold(alertEntity()); } Assert.assertEquals(N, holder.allAlerts().size()); }