TaskValidation extends Validation { public ValidationResult isDurationValid(String duration) { if (duration.isEmpty()) { return new ValidationResult(ValidationStatus.VALID); } return isNumber(duration); } TaskValidation(StringsProvider stringsProvider,
            TaskTemplateRepository taskTemplateRepository); ValidationResult isNewNameValid(String name); ValidationResult isUpdateNameValid(Long taskId, String name); ValidationResult isDurationValid(String duration);  }
@Test public void whenDurationIsANumberExpectIsValid() { ValidationResult validationResult = taskValidation.isDurationValid(VALID_DURATION); assertThat(validationResult.getValidationStatus(), is(ValidationStatus.VALID)); }
@Test public void whenDurationIsEmptyExpectIsValid() { ValidationResult validationResult = taskValidation.isDurationValid(EMPTY_DURATION); assertThat(validationResult.getValidationStatus(), is(ValidationStatus.VALID)); }
@Test public void whenDurationIsNotANumberExpectIsNotValid() { ValidationResult validationResult = taskValidation.isDurationValid(INVALID_DURATION); assertThat(validationResult.getValidationStatus(), is(ValidationStatus.INVALID)); assertThat(validationResult.getValidationInfo(), is(ERROR_MESSAGE_ONLY_NUMBERS)); }