@Test public void testOnInitialized() { PersistenceStrategy<Data> persistenceStrategy = mock(PersistenceStrategy.class); Context context = RuntimeEnvironment.application; OnBatchReadyListener onBatchReadyListener = mock(OnBatchReadyListener.class); Handler handler = new Handler(); BaseBatchingStrategy<Data, Batch<Data>> baseBatchingStrategy = new BaseBatchingStrategy<Data, Batch<Data>>(persistenceStrategy) { @Override public void flush(boolean forced) { } }; baseBatchingStrategy.onInitialized(context, onBatchReadyListener, handler); Assert.assertTrue(baseBatchingStrategy.isInitialized()); Assert.assertNotNull(baseBatchingStrategy.getContext()); Assert.assertNotNull(baseBatchingStrategy.getOnReadyListener()); }
@Override public void onInitialized(Context context, OnBatchReadyListener<E, T> onBatchReadyListener, Handler handler) { this.initialized = true; this.onReadyListener = onBatchReadyListener; this.context = context; this.persistenceStrategy.onInitialized(); }
BaseBatchingStrategy implements BatchingStrategy<E, T> { @Override public void onInitialized(Context context, OnBatchReadyListener<E, T> onBatchReadyListener, Handler handler) { this.initialized = true; this.onReadyListener = onBatchReadyListener; this.context = context; this.persistenceStrategy.onInitialized(); } }
BaseBatchingStrategy implements BatchingStrategy<E, T> { @Override public void onInitialized(Context context, OnBatchReadyListener<E, T> onBatchReadyListener, Handler handler) { this.initialized = true; this.onReadyListener = onBatchReadyListener; this.context = context; this.persistenceStrategy.onInitialized(); } BaseBatchingStrategy(PersistenceStrategy<E> persistenceStrategy); }
BaseBatchingStrategy implements BatchingStrategy<E, T> { @Override public void onInitialized(Context context, OnBatchReadyListener<E, T> onBatchReadyListener, Handler handler) { this.initialized = true; this.onReadyListener = onBatchReadyListener; this.context = context; this.persistenceStrategy.onInitialized(); } BaseBatchingStrategy(PersistenceStrategy<E> persistenceStrategy); @Override boolean isInitialized(); @Override void onDataPushed(Collection<E> dataCollection); @Override abstract void flush(boolean forced); @Override void onInitialized(Context context,
                              OnBatchReadyListener<E, T> onBatchReadyListener, Handler handler); Context getContext(); OnBatchReadyListener<E, T> getOnReadyListener(); PersistenceStrategy<E> getPersistenceStrategy(); }
BaseBatchingStrategy implements BatchingStrategy<E, T> { @Override public void onInitialized(Context context, OnBatchReadyListener<E, T> onBatchReadyListener, Handler handler) { this.initialized = true; this.onReadyListener = onBatchReadyListener; this.context = context; this.persistenceStrategy.onInitialized(); } BaseBatchingStrategy(PersistenceStrategy<E> persistenceStrategy); @Override boolean isInitialized(); @Override void onDataPushed(Collection<E> dataCollection); @Override abstract void flush(boolean forced); @Override void onInitialized(Context context,
                              OnBatchReadyListener<E, T> onBatchReadyListener, Handler handler); Context getContext(); OnBatchReadyListener<E, T> getOnReadyListener(); PersistenceStrategy<E> getPersistenceStrategy();  }