ActionSetFieldsPage extends AbstractGuidedDecisionTableWizardPage implements
        ActionSetFieldsPageView.Presenter { @Override public void prepareView() { List<Pattern52> availablePatterns = new ArrayList<Pattern52>(); for (Pattern52 p : model.getPatterns()) { if (p.getChildColumns().size() > 0) { availablePatterns.add(p); } else { patternToActionsMap.remove(p); } } view.setAvailablePatterns(availablePatterns); }  @Override String getTitle(); @Override void initialise(); @Override void prepareView(); @Override void isComplete(final Callback<Boolean> callback); void onPatternRemoved(final @Observes PatternRemovedEvent event); void onDuplicatePatterns(final @Observes DuplicatePatternsEvent event); void onActionSetFieldsDefined(final @Observes ActionSetFieldsDefinedEvent event); @Override void selectPattern(final Pattern52 pattern); @Override void makeResult(final GuidedDecisionTable52 model); @Override GuidedDecisionTable52.TableFormat getTableFormat(); @Override boolean hasEnums(final ActionSetFieldCol52 selectedAction); @Override void assertDefaultValue(final Pattern52 selectedPattern,
                                   final ActionSetFieldCol52 selectedAction); @Override void stateChanged();  }
@Test public void testPrepareViewNoPatterns() throws Exception { actionSetFieldsPage.prepareView(); verify(actionSetFieldsPageView).setAvailablePatterns(Collections.emptyList()); }
@Test public void testPrepareViewPatternsAvailableButNoConditionSpecified() throws Exception { model.setConditionPatterns(Collections.singletonList(new Pattern52())); actionSetFieldsPage.prepareView(); verify(actionSetFieldsPageView).setAvailablePatterns(Collections.emptyList()); }
@Test public void testPrepareView() throws Exception { final Pattern52 pattern = new Pattern52() {{ setFactType("Person"); setBoundName("p"); setChildColumns(Collections.singletonList(new ConditionCol52())); }}; model.setConditionPatterns(Collections.singletonList(pattern)); actionSetFieldsPage.prepareView(); verify(actionSetFieldsPageView).setAvailablePatterns(patternsCaptor.capture()); assertEquals(1, patternsCaptor.getValue().size()); assertEquals(pattern, patternsCaptor.getValue().get(0)); }