@Test
public void updatePreparations() throws Exception {

    // given
    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);
    // when
    updater.updatePreparations();
    // then
    verify(preparationRepository, times(1)).list(Preparation.class);
    verify(preparationRepository, times(1)).add(prep);
    verify(dataSetMetadataRepository, only()).get(datasetId);
}