public void testValidateInvalidExternalQuestion() throws Exception { HITQuestion htmlQuestion = new HITQuestion(defaultInvalidExternalQuestionFileName); try { service.previewHIT(defaultHITInput, defaultHITProperties, htmlQuestion); fail("Expected ValidationException when previewing HIT with invalid external question." ); } catch (ValidationException e) { // Expected exception } }
public void testValidateInvalidHTMLQuestion() throws Exception { // HTMLQuestion has invalid FrameHeight try { QAPValidator.validateFile(defaultInvalidHTMLQuestionFileName); fail("Expected ValidationException when previewing a HIT with an invalid HTMLQuestion"); } catch (ValidationException e) { // Expected exception assertContains("ValidationFailure was not caused by an invalid frame height.", "'I am not a number; I am a free man!' is not a valid value for 'integer'", e.getMessage()); } }
public void testCreateInvalidFormattedContentHIT() throws Exception { HITQuestion htmlQuestion = new HITQuestion(defaultInvalidFormattedContentQuestionFileName); try { service.previewHIT(defaultHITInput, defaultHITProperties, htmlQuestion); fail("Expected ValidationException when creating HIT with invalid formatted content." ); } catch (ValidationException e) { // Expected exception } }
public void testCreateScriptFormattedContentHIT() throws Exception { HITQuestion htmlQuestion = new HITQuestion(defaultScriptFormattedContentQuestionFileName); try { service.previewHIT(defaultHITInput, defaultHITProperties, htmlQuestion); fail("Expected ValidationException when creating HIT with script in formatted content." ); } catch (ValidationException e) { // Expected exception } }
public static void validate(String question) throws ValidationException, IOException { validate(question, false, QUESTION_FORM_XSD, false); }
public static void validateFile(String fileName) throws ValidationException, IOException { validate(fileName, true, QUESTION_FORM_XSD, false); }