use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class QuestionnaireValidatorTest method shouldThrowExceptionWhenQuestionTypeNotProvided.
@Test
public void shouldThrowExceptionWhenQuestionTypeNotProvided() {
try {
questionnaireValidator.validateForDefineQuestion(new QuestionDetail("Title 123", QuestionType.INVALID));
fail("Should have thrown the validation exception");
} catch (SystemException e) {
assertEquals(ANSWER_TYPE_NOT_PROVIDED, e.getKey());
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class QuestionnaireValidatorTest method shouldNotThrowExceptionForNumericQuestionType.
@Test
public void shouldNotThrowExceptionForNumericQuestionType() {
try {
QuestionDetail questionDetail = new QuestionDetail("Title", QuestionType.NUMERIC);
questionnaireValidator.validateForDefineQuestion(questionDetail);
} catch (SystemException e) {
fail("Should not have thrown the exception");
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class QuestionnaireValidatorTest method shouldThrowExceptionForNumericQuestionTypeWhenInvalidBoundsGiven.
@Test
public void shouldThrowExceptionForNumericQuestionTypeWhenInvalidBoundsGiven() {
try {
QuestionDetail questionDetail = new QuestionDetail("Title", QuestionType.NUMERIC);
questionDetail.setNumericMin(100);
questionDetail.setNumericMax(10);
questionnaireValidator.validateForDefineQuestion(questionDetail);
fail("Should have thrown the exception");
} catch (SystemException e) {
assertEquals(INVALID_NUMERIC_BOUNDS, e.getKey());
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class QuestionnaireValidatorTest method shouldThrowExceptionWhenQuestionTitleIsProvided.
@Test
public void shouldThrowExceptionWhenQuestionTitleIsProvided() {
try {
questionnaireValidator.validateForDefineQuestion(new QuestionDetail(null, QuestionType.FREETEXT));
fail("Should have thrown the validation exception");
} catch (SystemException e) {
assertEquals(QUESTION_TEXT_NOT_PROVIDED, e.getKey());
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class QuestionnaireValidatorTest method shouldNotThrowExceptionForNumericQuestionTypeWhenOnlyMinBoundGiven.
@Test
public void shouldNotThrowExceptionForNumericQuestionTypeWhenOnlyMinBoundGiven() {
try {
QuestionDetail questionDetail = new QuestionDetail("Title", QuestionType.NUMERIC);
questionDetail.setNumericMin(10);
questionnaireValidator.validateForDefineQuestion(questionDetail);
} catch (SystemException e) {
fail("Should not have thrown the exception");
}
}
Aggregations