ValueOptionsPage extends BaseDecisionTableColumnPage<T> { boolean canSetupDefaultValue() { if (!isDefaultValueEnabled()) { return false; } if (tableFormat() != GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) { return false; } if (doesNotHaveFactTypeOrFactField()) { return false; } if (!plugin().doesOperatorNeedValue()) { return false; } return true; } @Inject  ValueOptionsPage(final View view,
                            final TranslationService translationService); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void prepareView(); void enableValueList(); void enableCepOperators(); void enableDefaultValue(); void enableLimitedValue(); String getValueList(); void setValueList(final String valueList); int constraintValue();  }
@Test public void testCanSetupDefaultValueWhenEditingColIsNull() throws Exception { when(plugin.editingCol()).thenReturn(null); assertFalse(page.canSetupDefaultValue()); }
@Test public void testCanSetupDefaultValueWhenEditingPatternIsNull() throws Exception { when(plugin.patternWrapper()).thenReturn(null); assertFalse(page.canSetupDefaultValue()); }
@Test public void testCanSetupDefaultValueWhenEditingColHasAnEmptyFactType() throws Exception { when(editingCol.getFactField()).thenReturn(""); assertFalse(page.canSetupDefaultValue()); }
@Test public void testCanSetupDefaultValueWhenOperatorNeedsAValue() throws Exception { when(editingCol.getFactField()).thenReturn("factField"); when(plugin.doesOperatorNeedValue()).thenReturn(false); assertFalse(page.canSetupDefaultValue()); }
@Test public void testCanSetupDefaultValueWhenTableFormatIsNotExtendedEntry() throws Exception { when(editingCol.getFactField()).thenReturn("factField"); when(plugin.doesOperatorNeedValue()).thenReturn(true); when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.LIMITED_ENTRY); assertFalse(page.canSetupDefaultValue()); }
@Test public void testCanSetupDefaultValueWhenItIsNotEnabled() throws Exception { when(plugin.getFactField()).thenReturn("factField"); when(plugin.getFactType()).thenReturn("factType"); when(plugin.doesOperatorNeedValue()).thenReturn(true); when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY); assertFalse(page.canSetupDefaultValue()); }