RosieRepository implements ReadableDataSource<K, V>, WriteableDataSource<K, V> { @Override public void deleteAll() throws Exception { for (WriteableDataSource<K, V> writeableDataSource : writeableDataSources) { writeableDataSource.deleteAll(); } for (CacheDataSource<K, V> cacheDataSource : cacheDataSources) { cacheDataSource.deleteAll(); } }  @Override V getByKey(K key); V getByKey(K key, ReadPolicy policy); @Override Collection<V> getAll(); Collection<V> getAll(ReadPolicy policy); @Override V addOrUpdate(V value); V addOrUpdate(V value, WritePolicy policy); @Override Collection<V> addOrUpdateAll(Collection<V> values); Collection<V> addOrUpdateAll(Collection<V> values, WritePolicy policy); @Override void deleteByKey(K key); @Override void deleteAll();  }
@Test public void shouldDeleteAllDataSources() throws Exception { RosieRepository<?, ?> repository = givenAWriteableAndCacheRepository(); repository.deleteAll(); verify(writeableDataSource).deleteAll(); verify(cacheDataSource).deleteAll(); }