ValueOptionsPage extends BaseDecisionTableColumnPage<T> { boolean canSetupLimitedValue() { if (!isLimitedValueEnabled()) { return false; } if (tableFormat() != GuidedDecisionTable52.TableFormat.LIMITED_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 testCanSetupLimitedValueWhenEditingColIsNull() throws Exception { when(plugin.editingCol()).thenReturn(null); assertFalse(page.canSetupLimitedValue()); }
@Test public void testCanSetupLimitedValueWhenEditingPatternIsNull() throws Exception { when(plugin.patternWrapper()).thenReturn(null); assertFalse(page.canSetupLimitedValue()); }
@Test public void testCanSetupLimitedValueWhenEditingColIsNotAnInstanceOfLimitedEntryConditionCol52() throws Exception { when(plugin.editingCol()).thenReturn(new ConditionCol52()); assertFalse(page.canSetupLimitedValue()); }
@Test public void testCanSetupLimitedValueWhenOperatorNeedsAValue() throws Exception { when(plugin.editingCol()).thenReturn(new LimitedEntryConditionCol52()); when(plugin.doesOperatorNeedValue()).thenReturn(false); assertFalse(page.canSetupLimitedValue()); }
@Test public void testCanSetupLimitedValueWhenTableFormatIsNotLimitedEntry() throws Exception { when(plugin.editingCol()).thenReturn(new LimitedEntryConditionCol52()); when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY); when(plugin.doesOperatorNeedValue()).thenReturn(true); assertFalse(page.canSetupLimitedValue()); }