### Question:
RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } RuleFlowGroupDataProvider(); @Inject  RuleFlowGroupDataProvider(final StunnerFormsHandler formsHandler); List<RuleFlowGroup> getRuleFlowGroupNames();  }### Answer:
@Test public void testOnRuleFlowGroupDataChanged() { RuleFlowGroup group1 = new RuleFlowGroup("g1"); RuleFlowGroup group2 = new RuleFlowGroup("g2"); RuleFlowGroupDataEvent event = mock(RuleFlowGroupDataEvent.class); when(event.getGroups()).thenReturn(new RuleFlowGroup[]{group1, group2}); tested.onRuleFlowGroupDataChanged(event); verify(formsHandler, times(1)).refreshCurrentSessionForms(eq(BPMNDefinitionSet.class)); List<RuleFlowGroup> values = tested.getRuleFlowGroupNames(); assertNotNull(values); assertEquals(2, values.size()); assertEquals("g1", values.get(0).getName()); assertEquals("g2", values.get(1).getName()); }
@Test public void testOnRuleFlowGroupDataNotChanged() { RuleFlowGroup group1 = new RuleFlowGroup("g1"); RuleFlowGroup group2 = new RuleFlowGroup("g2"); tested.groups.add(group1); tested.groups.add(group2); RuleFlowGroupDataEvent event = mock(RuleFlowGroupDataEvent.class); when(event.getGroups()).thenReturn(new RuleFlowGroup[]{group1, group2}); tested.onRuleFlowGroupDataChanged(event); verify(formsHandler, never()).refreshCurrentSessionForms(any(Class.class)); }