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