### Question:
UpdateRule implements IUpdateRule<EXPERIENCE_TYPE> { @Override public void update(List<EXPERIENCE_TYPE> trainingBatch) { RESULT_TYPE featuresLabels = updateAlgorithm.compute(trainingBatch); updater.update(featuresLabels); ++updateCount; } UpdateRule(@NonNull IUpdateAlgorithm<RESULT_TYPE, EXPERIENCE_TYPE> updateAlgorithm,
                      @NonNull INeuralNetUpdater<RESULT_TYPE> updater); @Override void update(List<EXPERIENCE_TYPE> trainingBatch); @Override void notifyNewBatchStarted();  }### Answer:
@Test public void when_callingUpdate_expect_computeAndUpdateNetwork() { List<Integer> trainingBatch = new ArrayList<Integer>() { { Integer.valueOf(1); Integer.valueOf(2); } }; final FeaturesLabels computeResult = new FeaturesLabels(null); when(updateAlgorithm.compute(any())).thenReturn(computeResult); sut.update(trainingBatch); verify(updateAlgorithm, times(1)).compute(trainingBatch); verify(updater, times(1)).update(computeResult); }
@Test public void when_callingUpdate_expect_updateCountIncremented() { sut.update(null); int updateCountBefore = sut.getUpdateCount(); sut.update(null); int updateCountAfter = sut.getUpdateCount(); assertEquals(updateCountBefore + 1, updateCountAfter); }