test/org/ohmage/validator/AuditValidatorsTest.java
@Test
	public void testValidateErrorCode() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(AuditValidators.validateErrorCode(emptyValue));
			}
			
			try {
				AuditValidators.validateErrorCode("Invalid value.");
				fail("The error code was an invalid value.");
			}
			catch(ValidationException e) { 
				// Passed.
			}
			
			ErrorCode[] errorCodes = Annotator.ErrorCode.values();
			for(int i = 0; i < errorCodes.length; i++) {
				Assert.assertEquals(
						errorCodes[i], 
						AuditValidators.validateErrorCode(
								errorCodes[i].toString()
							)
					);
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the error code validator.
	 */
Tests the error code validator.
Tests the error code validator .
@Test
	public void testValidateErrorCode() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(AuditValidators.validateErrorCode(emptyValue));
			}
			try {
				AuditValidators.validateErrorCode("Invalid value.");
				fail("The error code was an invalid value.");
			}
			catch(ValidationException e) { 
			}
			ErrorCode[] errorCodes = Annotator.ErrorCode.values();
			for(int i = 0; i < errorCodes.length; i++) {
				Assert.assertEquals(
						errorCodes[i], 
						AuditValidators.validateErrorCode(
								errorCodes[i].toString()
							)
					);
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateErrorCode ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( AuditValidators . validateErrorCode ( emptyValue ) ) ; } try { AuditValidators . validateErrorCode ( "Invalid value." ) ; fail ( "The error code was an invalid value." ) ; } catch ( ValidationException e ) { } ErrorCode [ ] errorCodes = Annotator . ErrorCode . values ( ) ; for ( int i = 0 ; i < errorCodes . length ; i ++ ) { Assert . assertEquals ( errorCodes [ i ] , AuditValidators . validateErrorCode ( errorCodes [ i ] . toString ( ) ) ) ; } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the error code validator.
Tests the error code validator .
// Passed.