test/org/ohmage/validator/ClassValidatorsTest.java
@Test
	public void testValidateClassIdList() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(ClassValidators.validateClassIdList(emptyValue));
			}
			
			try {
				ClassValidators.validateClassIdList("Invalid value.");
				fail("The class ID list was invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			for(String validUrnList : ParameterSets.getValidUrnLists()) {
				try {
					ClassValidators.validateClassIdList(validUrnList);
				}
				catch(ValidationException e) {
					fail("A valid URN list was declared invalid: " + validUrnList);
				}
			}
			
			for(String invalidUrnList : ParameterSets.getInvalidUrnLists()) {
				try {
					ClassValidators.validateClassIdList(invalidUrnList);
					fail("An invalid URN list passed validation: " + invalidUrnList);
				}
				catch(ValidationException e) {
					// Passed.
				}
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the class ID list validator.
	 */
Tests the class ID list validator.
Tests the class ID list validator .
@Test
	public void testValidateClassIdList() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(ClassValidators.validateClassIdList(emptyValue));
			}
			try {
				ClassValidators.validateClassIdList("Invalid value.");
				fail("The class ID list was invalid.");
			}
			catch(ValidationException e) {
			}
			for(String validUrnList : ParameterSets.getValidUrnLists()) {
				try {
					ClassValidators.validateClassIdList(validUrnList);
				}
				catch(ValidationException e) {
					fail("A valid URN list was declared invalid: " + validUrnList);
				}
			}
			for(String invalidUrnList : ParameterSets.getInvalidUrnLists()) {
				try {
					ClassValidators.validateClassIdList(invalidUrnList);
					fail("An invalid URN list passed validation: " + invalidUrnList);
				}
				catch(ValidationException e) {
				}
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateClassIdList ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( ClassValidators . validateClassIdList ( emptyValue ) ) ; } try { ClassValidators . validateClassIdList ( "Invalid value." ) ; fail ( "The class ID list was invalid." ) ; } catch ( ValidationException e ) { } for ( String validUrnList : ParameterSets . getValidUrnLists ( ) ) { try { ClassValidators . validateClassIdList ( validUrnList ) ; } catch ( ValidationException e ) { fail ( "A valid URN list was declared invalid: " + validUrnList ) ; } } for ( String invalidUrnList : ParameterSets . getInvalidUrnLists ( ) ) { try { ClassValidators . validateClassIdList ( invalidUrnList ) ; fail ( "An invalid URN list passed validation: " + invalidUrnList ) ; } catch ( ValidationException e ) { } } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the class ID list validator.
Tests the class ID list validator .
// Passed. // Passed.