@Test @SuppressWarnings("unchecked") public void testGetSelectorData() { RuleFlowGroup group1 = new RuleFlowGroup("g1"); group1.setPathUri("default: RuleFlowGroup group2 = new RuleFlowGroup("g2"); group2.setPathUri("default: RuleFlowGroup group3 = new RuleFlowGroup("g1"); group3.setPathUri("default: List<RuleFlowGroup> groups = Arrays.asList(group1, group2, group3); when(dataProvider.getRuleFlowGroupNames()).thenReturn(groups); FormRenderingContext context = mock(FormRenderingContext.class); SelectorData data = tested.getSelectorData(context); Map<String, String> values = data.getValues(); assertNotNull(values); assertEquals(2, values.size()); assertEquals("g2 [Project1]", values.get(group2.getName())); assertEquals("g1 [Project1, Project2]", values.get(group1.getName())); verify(requestRuleFlowGroupDataEvent, times(1)).fire(any(RequestRuleFlowGroupDataEvent.class)); }
@Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); }
RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } }
RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); }  }
RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); }  @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton(); }
RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); }  @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton();  }