DataSetContentListener { public void unregister(@Observes RemovedRuntimeModelEvent removedRuntimeModelEvent) { List<String> removedIds = runtimeModelDatasetContents.remove(removedRuntimeModelEvent.getRuntimeModelId()); if (removedIds != null) { removedIds.forEach(id -> { storage.deleteCSVFile(id); registry.removeDataSetDef(id); }); } }  @PostConstruct void init(); void register(@Observes NewDataSetContentEvent newDataSetContentEvent); void unregister(@Observes RemovedRuntimeModelEvent removedRuntimeModelEvent); void registerDataSetContent(final DataSetContent content);  }
@Test public void testUnregister() { final String id = "ID"; final String C1 = "C1"; List<String> registeredContent = Arrays.asList(C1); when(runtimeModelDatasetContents.remove(matches(id))).thenReturn(registeredContent); datasetContentListener.unregister(new RemovedRuntimeModelEvent(id)); verify(storage).deleteCSVFile(matches(C1)); verify(registry).removeDataSetDef(matches(C1)); }