test/org/ohmage/validator/SurveyResponseValidatorsTest.java
@Test
	public void testValidateSurveyResponseId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(SurveyResponseValidators.validateSurveyResponseId(emptyValue));
			}
			
			try {
				SurveyResponseValidators.validateSurveyResponseId("Invalid value.");
				fail("The survey response ID was invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			// This may be any long value as it is simply a database ID.
			UUID uuid = UUID.randomUUID();
			Assert.assertEquals(uuid, SurveyResponseValidators.validateSurveyResponseId(uuid.toString()));
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the survey response ID validator.
	 */
Tests the survey response ID validator.
Tests the survey response ID validator .
@Test
	public void testValidateSurveyResponseId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(SurveyResponseValidators.validateSurveyResponseId(emptyValue));
			}
			try {
				SurveyResponseValidators.validateSurveyResponseId("Invalid value.");
				fail("The survey response ID was invalid.");
			}
			catch(ValidationException e) {
			}
			UUID uuid = UUID.randomUUID();
			Assert.assertEquals(uuid, SurveyResponseValidators.validateSurveyResponseId(uuid.toString()));
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateSurveyResponseId ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( SurveyResponseValidators . validateSurveyResponseId ( emptyValue ) ) ; } try { SurveyResponseValidators . validateSurveyResponseId ( "Invalid value." ) ; fail ( "The survey response ID was invalid." ) ; } catch ( ValidationException e ) { } UUID uuid = UUID . randomUUID ( ) ; Assert . assertEquals ( uuid , SurveyResponseValidators . validateSurveyResponseId ( uuid . toString ( ) ) ) ; } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the survey response ID validator.
Tests the survey response ID validator .
// Passed. // This may be any long value as it is simply a database ID.