TerminationTreeItemContent implements IsElement { public void setExistingValue(Object value, TerminationConfigOption terminationConfigOption) { TerminationManager operation = terminationManagerMap.get(terminationConfigOption); if (operation != null) { operation.setExistingValue(value); } } @Inject  TerminationTreeItemContent(final TerminationTreeItemContentView view,
                                      final TranslationService translationService); TreeItem getTreeItem(); TerminationConfigModel getModel(); TerminationConfigOption getTerminationConfigOption(); void removeDropDownOption(TerminationConfigOption terminationConfigOption); TerminationTreeItemContentView getView(); void setModel(TerminationConfigModel model); void setTerminationConfigOption(TerminationConfigOption terminationConfigOption); void setTreeItem(TreeItem treeItem); void onTerminationTypeSelected(String terminationType); void setTerminationConfigForm(TerminationConfigForm terminationConfigForm); void removeTreeItem(); void onDaysSpentChange(Long value); void onHoursSpentChange(Long value); void onMinutesSpentChange(Long value); void onSecondsSpentChange(Long value); void onMillisecondsSpentChange(Long value); void onUnimprovedDaysSpentChange(Long value); void onUnimprovedHoursSpentChange(Long value); void onUnimprovedMinutesSpentChange(Long value); void onUnimprovedSecondsSpentChange(Long value); void onUnimprovedMillisecondsSpentChange(Long value); void onStepCountLimitChange(Integer value); void onUnimprovedStepCountLimitChange(Integer value); void onScoreCalculationLimitChange(Long value); void onFeasibilityChange(Boolean value); void onBestScoreLimitChange(String value); void onTerminationCompositionStyleChange(TerminationCompositionStyleModel value); void setExistingValue(Object value,
                                 TerminationConfigOption terminationConfigOption); void setNewValue(TerminationConfigOption terminationConfigOption); @Override HTMLElement getElement(); static final long MINUTES_SPENT_DEFAULT_VALUE; static final long UNIMPROVED_MINUTES_SPENT_DEFAULT_VALUE; }
@Test public void setExistingTimeSpentValue() { when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.MILLISECONDS_SPENT_LIMIT)).thenReturn(1L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.SECONDS_SPENT_LIMIT)).thenReturn(2L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.MINUTES_SPENT_LIMIT)).thenReturn(3L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.HOURS_SPENT_LIMIT)).thenReturn(4L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.DAYS_SPENT_LIMIT)).thenReturn(5L); terminationTreeItemContent.setExistingValue(1L, TerminationConfigOption.MILLISECONDS_SPENT_LIMIT); verify(view).setMillisecondsSpent(1L); verify(view).setSecondsSpent(2L); verify(view).setMinutesSpent(3L); verify(view).setHoursSpent(4L); verify(view).setDaysSpent(5L); verify(terminationConfigModel).setMillisecondsSpentLimit(1L); verify(terminationConfigModel).setSecondsSpentLimit(2L); verify(terminationConfigModel).setMinutesSpentLimit(3L); verify(terminationConfigModel).setHoursSpentLimit(4L); verify(terminationConfigModel).setDaysSpentLimit(5L); }
@Test public void setExistingUnimprovedTimeSpentValue() { when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.UNIMPROVED_MILLISECONDS_SPENT_LIMIT)).thenReturn(1L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.UNIMPROVED_SECONDS_SPENT_LIMIT)).thenReturn(2L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.UNIMPROVED_MINUTES_SPENT_LIMIT)).thenReturn(3L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.UNIMPROVED_HOURS_SPENT_LIMIT)).thenReturn(4L); when(terminationConfigForm.getTerminationValue(terminationConfigModel, TerminationConfigOption.UNIMPROVED_DAYS_SPENT_LIMIT)).thenReturn(5L); terminationTreeItemContent.setExistingValue(1L, TerminationConfigOption.UNIMPROVED_MILLISECONDS_SPENT_LIMIT); verify(view).setUnimprovedMillisecondsSpent(1L); verify(view).setUnimprovedSecondsSpent(2L); verify(view).setUnimprovedMinutesSpent(3L); verify(view).setUnimprovedHoursSpent(4L); verify(view).setUnimprovedDaysSpent(5L); verify(terminationConfigModel).setUnimprovedMillisecondsSpentLimit(1L); verify(terminationConfigModel).setUnimprovedSecondsSpentLimit(2L); verify(terminationConfigModel).setUnimprovedMinutesSpentLimit(3L); verify(terminationConfigModel).setUnimprovedHoursSpentLimit(4L); verify(terminationConfigModel).setUnimprovedDaysSpentLimit(5L); }
@Test public void setExistingBestScoreLimitValue() { terminationTreeItemContent.setExistingValue("0", TerminationConfigOption.BEST_SCORE_LIMIT); verify(view).setBestScoreLimit("0"); }
@Test public void setExistingBestScoreFeasibleValue() { terminationTreeItemContent.setExistingValue(true, TerminationConfigOption.BEST_SCORE_FEASIBLE); verify(view).setBestScoreFeasible(true); }
@Test public void setExistingStepCountLimitValue() { terminationTreeItemContent.setExistingValue(1, TerminationConfigOption.STEP_COUNT_LIMIT); verify(view).setStepCountLimit(1); }
@Test public void setExistingUnimprovedStepCountLimitValue() { terminationTreeItemContent.setExistingValue(1, TerminationConfigOption.UNIMPROVED_STEP_COUNT_LIMIT); verify(view).setUnimprovedStepCountLimit(1); }
@Test public void setExistingScoreCalculationCountLimitValue() { terminationTreeItemContent.setExistingValue(1, TerminationConfigOption.SCORE_CALCULATION_COUNT_LIMIT); verify(view).setScoreCalculationCountLimit(1L); }
@Test public void setExistingTerminationCompositionStyleValue() { terminationTreeItemContent.setExistingValue(TerminationCompositionStyleModel.AND, TerminationConfigOption.TERMINATION_COMPOSITION_STYLE); verify(view).setTerminationCompositionStyle(TerminationCompositionStyleModel.AND); }