@Test public void testInit() { final List<DefinitionSetService> definitionSetServices = new LinkedList<>(); final DefinitionSetService definitionSetService1 = mock(DefinitionSetService.class); final DefinitionSetService definitionSetService2 = mock(DefinitionSetService.class); definitionSetServices.add(definitionSetService1); definitionSetServices.add(definitionSetService2); when(definitionSetServiceInstances.iterator()).thenReturn(definitionSetServices.iterator()); doAnswer(invocation -> { final Consumer consumer = invocation.getArgumentAt(0, Consumer.class); Iterator var2 = definitionSetServiceInstances.iterator(); while (var2.hasNext()) { Object t = var2.next(); consumer.accept(t); } return null; }).when(definitionSetServiceInstances).forEach(any(Consumer.class)); tested.init(); assertEquals(tested.definitionSetServices.size(), definitionSetServices.size()); tested.definitionSetServices.containsAll(definitionSetServices); }
@PostConstruct public void init() { definitionSetServiceInstances.forEach(i -> definitionSetServices.add(i)); }
CaseManagementSwitchViewServiceImpl implements CaseManagementSwitchViewService { @PostConstruct public void init() { definitionSetServiceInstances.forEach(i -> definitionSetServices.add(i)); } }
CaseManagementSwitchViewServiceImpl implements CaseManagementSwitchViewService { @PostConstruct public void init() { definitionSetServiceInstances.forEach(i -> definitionSetServices.add(i)); } @Inject  CaseManagementSwitchViewServiceImpl(final FactoryManager factoryManager,
                                               final Instance<DefinitionSetService> definitionSetServiceInstances); }
CaseManagementSwitchViewServiceImpl implements CaseManagementSwitchViewService { @PostConstruct public void init() { definitionSetServiceInstances.forEach(i -> definitionSetServices.add(i)); } @Inject  CaseManagementSwitchViewServiceImpl(final FactoryManager factoryManager,
                                               final Instance<DefinitionSetService> definitionSetServiceInstances); @PostConstruct void init(); @Override @SuppressWarnings("unchecked") Optional<ProjectDiagram> switchView(final Diagram diagram, final String mappedDefSetId, final String mappedShapeSetId); }
CaseManagementSwitchViewServiceImpl implements CaseManagementSwitchViewService { @PostConstruct public void init() { definitionSetServiceInstances.forEach(i -> definitionSetServices.add(i)); } @Inject  CaseManagementSwitchViewServiceImpl(final FactoryManager factoryManager,
                                               final Instance<DefinitionSetService> definitionSetServiceInstances); @PostConstruct void init(); @Override @SuppressWarnings("unchecked") Optional<ProjectDiagram> switchView(final Diagram diagram, final String mappedDefSetId, final String mappedShapeSetId);  }