FactPatternConstraintsPage extends AbstractGuidedDecisionTableWizardPage implements
        FactPatternConstraintsPageView.Presenter { @Override public void selectPattern(final Pattern52 pattern) { if (pattern == null) { return; } final String type = pattern.getFactType(); oracle.getFieldCompletions(type, new Callback<ModelField[]>() { @Override public void callback(final ModelField[] fields) { final List<AvailableField> availableFields = new ArrayList<AvailableField>(); for (ModelField modelField : fields) { final String fieldName = modelField.getName(); final String fieldType = oracle.getFieldType(type, fieldName); final String fieldDisplayType = HumanReadableDataTypes.getUserFriendlyTypeName(fieldType); final AvailableField field = new AvailableField(fieldName, fieldType, fieldDisplayType, BaseSingleFieldConstraint.TYPE_LITERAL); availableFields.add(field); } if (model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) { final AvailableField field = new AvailableField(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardPredicate(), BaseSingleFieldConstraint.TYPE_PREDICATE); availableFields.add(field); } view.setAvailableFields(availableFields); view.setChosenConditions(pattern.getChildColumns()); } }); }  @Override String getTitle(); @Override void initialise(); @Override void prepareView(); @Override void isComplete(final Callback<Boolean> callback); void onDuplicatePatterns(final @Observes DuplicatePatternsEvent event); void onConditionsDefined(final @Observes ConditionsDefinedEvent event); @Override void selectPattern(final Pattern52 pattern); @Override void setChosenConditions(final Pattern52 pattern,
                                    final List<ConditionCol52> conditions); @Override void getOperatorCompletions(final Pattern52 selectedPattern,
                                       final ConditionCol52 selectedCondition,
                                       final Callback<String[]> callback); @Override GuidedDecisionTable52.TableFormat getTableFormat(); @Override boolean hasEnum(final Pattern52 selectedPattern,
                           final ConditionCol52 selectedCondition); @Override boolean requiresValueList(final Pattern52 selectedPattern,
                                     final ConditionCol52 selectedCondition); @Override void assertDefaultValue(final Pattern52 selectedPattern,
                                   final ConditionCol52 selectedCondition); @Override void stateChanged();  }
@Test public void testSelectPattern() throws Exception { page.selectPattern(pattern); verify(view).setAvailableFields(availableFieldsCaptor.capture()); List<AvailableField> availableFields = availableFieldsCaptor.getValue(); assertEquals(4, availableFields.size()); assertTrue(availableFields.stream() .allMatch(field -> field.getCalculationType() == BaseSingleFieldConstraint.TYPE_LITERAL && ((field.getName().compareTo("this") == 0 && field.getType().compareTo(DataType.TYPE_THIS) == 0) || (field.getName().compareTo("street") == 0 && field.getType().compareTo(String.class.getSimpleName()) == 0) || (field.getName().compareTo("homeAddress") == 0 && field.getType().compareTo(Boolean.class.getSimpleName()) == 0) || (field.getName().compareTo("number") == 0 && field.getType().compareTo(Integer.class.getSimpleName()) == 0)) ) ); verify(view).setChosenConditions(conditions); }