PreparationDatasetRowUpdater { public void updatePreparations() { updatePreparations(preparationRepository); }  void updatePreparations(); void updatePreparations(PreparationRepository repository);  }
@Test public void updatePreparations() throws Exception { String datasetId = "dataset id"; Preparation prep = new Preparation("prepId", "123456"); prep.setDataSetId(datasetId); final List<Preparation> preparations = singletonList(prep); when(preparationRepository.list(Preparation.class)).thenReturn(preparations.stream()); DataSetMetadata datasetMetadata = new DataSetMetadata(); datasetMetadata.setRowMetadata(new RowMetadata()); when(dataSetMetadataRepository.get(datasetId)).thenReturn(datasetMetadata); updater.updatePreparations(); verify(preparationRepository, times(1)).list(Preparation.class); verify(preparationRepository, times(1)).add(prep); verify(dataSetMetadataRepository, only()).get(datasetId); }