test/org/ohmage/validator/CampaignValidatorsTest.java
@Test
	public void testValidateRole() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(CampaignValidators.validateRole(emptyValue));
			}
			
			try {
				CampaignValidators.validateRole("Invalid value.");
				fail("The campaign role was invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			Campaign.Role[] roles = Campaign.Role.values();
			for(int i = 0; i < roles.length; i++) {
				Assert.assertEquals(roles[i], CampaignValidators.validateRole(roles[i].toString()));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Test the campaign role validator.
	 */
Test the campaign role validator.
Test the campaign role validator .
@Test
	public void testValidateRole() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(CampaignValidators.validateRole(emptyValue));
			}
			try {
				CampaignValidators.validateRole("Invalid value.");
				fail("The campaign role was invalid.");
			}
			catch(ValidationException e) {
			}
			Campaign.Role[] roles = Campaign.Role.values();
			for(int i = 0; i < roles.length; i++) {
				Assert.assertEquals(roles[i], CampaignValidators.validateRole(roles[i].toString()));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateRole ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( CampaignValidators . validateRole ( emptyValue ) ) ; } try { CampaignValidators . validateRole ( "Invalid value." ) ; fail ( "The campaign role was invalid." ) ; } catch ( ValidationException e ) { } Campaign . Role [ ] roles = Campaign . Role . values ( ) ; for ( int i = 0 ; i < roles . length ; i ++ ) { Assert . assertEquals ( roles [ i ] , CampaignValidators . validateRole ( roles [ i ] . toString ( ) ) ) ; } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Test the campaign role validator.
Test the campaign role validator .
// Passed.