DataSetContentListener { public void register(@Observes NewDataSetContentEvent newDataSetContentEvent) { runtimeModelDatasetContents.put(newDataSetContentEvent.getRuntimeModelId(), newDataSetContentEvent.getContent() .stream() .map(DataSetContent::getId) .collect(Collectors.toList())); newDataSetContentEvent.getContent() .forEach(this::registerDataSetContent); }  @PostConstruct void init(); void register(@Observes NewDataSetContentEvent newDataSetContentEvent); void unregister(@Observes RemovedRuntimeModelEvent removedRuntimeModelEvent); void registerDataSetContent(final DataSetContent content);  }
@Test public void testRegister() throws Exception { final String runtimeModelId = "TEST"; final String C1 = "C1"; final String C2 = "C2"; final String content2 = "TESTCONTENT"; final String content3 = "TESTCSV"; List<DataSetContent> content = Arrays.asList(new DataSetContent(C1, content2, DataSetContentType.DEFINITION), new DataSetContent(C2, content3, DataSetContentType.CSV)); List<String> contentIds = Arrays.asList(C1, C2); DataSetDef def = mock(DataSetDef.class); when(defMarshaller.fromJson(matches(content2))).thenReturn(def); datasetContentListener.register(new NewDataSetContentEvent(runtimeModelId, content)); verify(runtimeModelDatasetContents).put(runtimeModelId, contentIds); verify(storage).storeCSV(C2, content3); verify(def).setUUID(matches(C1)); verify(registry).registerDataSetDef(def); }