test/org/ohmage/test/clazz/ClassApiTest.java
private void testClassDeletion(final String adminAuthToken) 
			throws ApiException {
		
		// No token.
		try {
			api.deleteClass(null, Controller.CLIENT, classId);
			throw new IllegalStateException("Failed: No authentication token.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: No authentication token: " + ErrorCode.AUTHENTICATION_FAILED, e);
			}
		}
		
		// Invalid token.
		try {
			api.deleteClass("invalid token", Controller.CLIENT, classId);
			throw new IllegalStateException("Failed: Invalid authentication token.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: Invalid authentication token: " + ErrorCode.AUTHENTICATION_FAILED, e);
			}
		}
		
		// No client.
		try {
			api.deleteClass(adminAuthToken, null, classId);
			throw new IllegalStateException("Failed: No client.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.SERVER_INVALID_CLIENT.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: No client: " + ErrorCode.SERVER_INVALID_CLIENT, e);
			}
		}
		
		// No class ID.
		try {
			api.deleteClass(adminAuthToken, Controller.CLIENT, null);
			throw new IllegalStateException("Failed: No class ID.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.CLASS_INVALID_ID.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: No class ID: " + ErrorCode.CLASS_INVALID_ID, e);
			}
		}
		
		// Invalid class ID.
		try {
			api.deleteClass(adminAuthToken, Controller.CLIENT, "invalid  ID");
			throw new IllegalStateException("Failed: Invalid class ID.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.CLASS_INVALID_ID.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: Invalid class ID: " + ErrorCode.CLASS_INVALID_ID, e);
			}
		}
		
		try {
			api.deleteClass(adminAuthToken, Controller.CLIENT, classId);
		}
		catch(RequestErrorException e) {
			throw new IllegalStateException("Failed: Class deletion.", e);
		}
		
		classId = null;
	}
/**
	 * Test class deletion then deletes the class defined by the class-level
	 * class ID and nulls its value.
	 * 
	 * @param adminAuthToken An administrator's authentication token.
	 * 
	 * @throws ApiException There was an unexpected error.
	 */
Test class deletion then deletes the class defined by the class-level
class ID and nulls its value.

@param adminAuthToken An administrator's authentication token.

@throws ApiException There was an unexpected error.
Test class deletion then deletes the class defined by the class - level class ID and nulls its value . @param adminAuthToken An administrator ' s authentication token . @throws ApiException There was an unexpected error .
private void testClassDeletion(final String adminAuthToken) 
			throws ApiException {
		try {
			api.deleteClass(null, Controller.CLIENT, classId);
			throw new IllegalStateException("Failed: No authentication token.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: No authentication token: " + ErrorCode.AUTHENTICATION_FAILED, e);
			}
		}
		try {
			api.deleteClass("invalid token", Controller.CLIENT, classId);
			throw new IllegalStateException("Failed: Invalid authentication token.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: Invalid authentication token: " + ErrorCode.AUTHENTICATION_FAILED, e);
			}
		}
		try {
			api.deleteClass(adminAuthToken, null, classId);
			throw new IllegalStateException("Failed: No client.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.SERVER_INVALID_CLIENT.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: No client: " + ErrorCode.SERVER_INVALID_CLIENT, e);
			}
		}
		try {
			api.deleteClass(adminAuthToken, Controller.CLIENT, null);
			throw new IllegalStateException("Failed: No class ID.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.CLASS_INVALID_ID.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: No class ID: " + ErrorCode.CLASS_INVALID_ID, e);
			}
		}
		try {
			api.deleteClass(adminAuthToken, Controller.CLIENT, "invalid  ID");
			throw new IllegalStateException("Failed: Invalid class ID.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.CLASS_INVALID_ID.equals(e.getErrorCode())) {
				throw new IllegalStateException("Failed: Invalid class ID: " + ErrorCode.CLASS_INVALID_ID, e);
			}
		}
		try {
			api.deleteClass(adminAuthToken, Controller.CLIENT, classId);
		}
		catch(RequestErrorException e) {
			throw new IllegalStateException("Failed: Class deletion.", e);
		}
		classId = null;
	}
private void testClassDeletion ( final String adminAuthToken ) throws ApiException { try { api . deleteClass ( null , Controller . CLIENT , classId ) ; throw new IllegalStateException ( "Failed: No authentication token." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . AUTHENTICATION_FAILED . equals ( e . getErrorCode ( ) ) ) { throw new IllegalStateException ( "Failed: No authentication token: " + ErrorCode . AUTHENTICATION_FAILED , e ) ; } } try { api . deleteClass ( "invalid token" , Controller . CLIENT , classId ) ; throw new IllegalStateException ( "Failed: Invalid authentication token." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . AUTHENTICATION_FAILED . equals ( e . getErrorCode ( ) ) ) { throw new IllegalStateException ( "Failed: Invalid authentication token: " + ErrorCode . AUTHENTICATION_FAILED , e ) ; } } try { api . deleteClass ( adminAuthToken , null , classId ) ; throw new IllegalStateException ( "Failed: No client." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . SERVER_INVALID_CLIENT . equals ( e . getErrorCode ( ) ) ) { throw new IllegalStateException ( "Failed: No client: " + ErrorCode . SERVER_INVALID_CLIENT , e ) ; } } try { api . deleteClass ( adminAuthToken , Controller . CLIENT , null ) ; throw new IllegalStateException ( "Failed: No class ID." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . CLASS_INVALID_ID . equals ( e . getErrorCode ( ) ) ) { throw new IllegalStateException ( "Failed: No class ID: " + ErrorCode . CLASS_INVALID_ID , e ) ; } } try { api . deleteClass ( adminAuthToken , Controller . CLIENT , "invalid  ID" ) ; throw new IllegalStateException ( "Failed: Invalid class ID." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . CLASS_INVALID_ID . equals ( e . getErrorCode ( ) ) ) { throw new IllegalStateException ( "Failed: Invalid class ID: " + ErrorCode . CLASS_INVALID_ID , e ) ; } } try { api . deleteClass ( adminAuthToken , Controller . CLIENT , classId ) ; } catch ( RequestErrorException e ) { throw new IllegalStateException ( "Failed: Class deletion." , e ) ; } classId = null ; }
Test class deletion then deletes the class defined by the class-level
 class ID and nulls its value.
Test class deletion then deletes the class defined by the class - level class ID and nulls its value .
// No token. // Invalid token. // No client. // No class ID. // Invalid class ID.