test/org/ohmage/validator/CampaignValidatorsTest.java
@Test
	public void testValidateCampaignId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(CampaignValidators.validateCampaignId(emptyValue));
			}
			
			try {
				CampaignValidators.validateCampaignId("Invalid value.");
				fail("The campaign ID was invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			for(String validUrn : ParameterSets.getValidUrns()) {
				try {
					CampaignValidators.validateCampaignId(validUrn);
				}
				catch(ValidationException e) {
					fail("A valid URN was declared invalid: " + validUrn);
				}
			}
			
			for(String invalidUrn : ParameterSets.getInvalidUrns()) {
				try {
					CampaignValidators.validateCampaignId(invalidUrn);
					fail("An invalid URN passed validation: " + invalidUrn);
				}
				catch(ValidationException e) {
					// Passed.
				}
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the campaign ID validator.
	 */
Tests the campaign ID validator.
Tests the campaign ID validator .
@Test
	public void testValidateCampaignId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(CampaignValidators.validateCampaignId(emptyValue));
			}
			try {
				CampaignValidators.validateCampaignId("Invalid value.");
				fail("The campaign ID was invalid.");
			}
			catch(ValidationException e) {
			}
			for(String validUrn : ParameterSets.getValidUrns()) {
				try {
					CampaignValidators.validateCampaignId(validUrn);
				}
				catch(ValidationException e) {
					fail("A valid URN was declared invalid: " + validUrn);
				}
			}
			for(String invalidUrn : ParameterSets.getInvalidUrns()) {
				try {
					CampaignValidators.validateCampaignId(invalidUrn);
					fail("An invalid URN passed validation: " + invalidUrn);
				}
				catch(ValidationException e) {
				}
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateCampaignId ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( CampaignValidators . validateCampaignId ( emptyValue ) ) ; } try { CampaignValidators . validateCampaignId ( "Invalid value." ) ; fail ( "The campaign ID was invalid." ) ; } catch ( ValidationException e ) { } for ( String validUrn : ParameterSets . getValidUrns ( ) ) { try { CampaignValidators . validateCampaignId ( validUrn ) ; } catch ( ValidationException e ) { fail ( "A valid URN was declared invalid: " + validUrn ) ; } } for ( String invalidUrn : ParameterSets . getInvalidUrns ( ) ) { try { CampaignValidators . validateCampaignId ( invalidUrn ) ; fail ( "An invalid URN passed validation: " + invalidUrn ) ; } catch ( ValidationException e ) { } } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the campaign ID validator.
Tests the campaign ID validator .
// Passed. // Passed.