test/org/ohmage/test/user/UserApiTests.java
private void testUserDeletion(final String adminAuthToken) 
			throws ApiException {
		
		Collection<String> usernames = new ArrayList<String>(1);
		usernames.add(username);
		
		// Token is null.
		try {
			api.deleteUser(null, Controller.CLIENT, usernames);
			throw new IllegalStateException("Failed: The authentication token was null.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The authentication token was null.", e);
			}
		}
		
		// Token is invalid.
		try {
			api.deleteUser("Invalid token", Controller.CLIENT, usernames);
			throw new IllegalStateException("Failed: The authentication token was invalid.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The authentication token was invalid.", e);
			}
		}
		
		// Client is null.
		try {
			api.deleteUser(adminAuthToken, null, usernames);
			throw new IllegalStateException("Failed: The client was null.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.SERVER_INVALID_CLIENT.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The client was null.", e);
			}
		}
		
		// Username list is null.
		try {
			api.deleteUser(adminAuthToken, Controller.CLIENT, null);
			throw new IllegalStateException("Failed: The username list was null.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.USER_INVALID_USERNAME.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The usernmae list was null.", e);
			}
		}
		
		// Deleting the user.
		try {
			api.deleteUser(adminAuthToken, Controller.CLIENT, usernames);
		}
		catch(ApiException e) {
			throw new IllegalArgumentException("Failed: Deleting the user.", e);
		}
	}
/**
	 * Tests user deletion and then deletes the user based on the class-level
	 * variables.
	 * 
	 * @param adminAuthToken An administrators authentication token to use when
	 * 						 creating and deleting users for testing.
	 * 
	 * @throws ApiException There was an unexpected error.
	 * 
	 * @throws IllegalStateException One of the tests failed.
	 */
Tests user deletion and then deletes the user based on the class-level
variables.

@param adminAuthToken An administrators authentication token to use when
creating and deleting users for testing.

@throws ApiException There was an unexpected error.

@throws IllegalStateException One of the tests failed.
Tests user deletion and then deletes the user based on the class - level variables . @param adminAuthToken An administrators authentication token to use when creating and deleting users for testing . @throws ApiException There was an unexpected error . @throws IllegalStateException One of the tests failed .
private void testUserDeletion(final String adminAuthToken) 
			throws ApiException {
		Collection<String> usernames = new ArrayList<String>(1);
		usernames.add(username);
		try {
			api.deleteUser(null, Controller.CLIENT, usernames);
			throw new IllegalStateException("Failed: The authentication token was null.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The authentication token was null.", e);
			}
		}
		try {
			api.deleteUser("Invalid token", Controller.CLIENT, usernames);
			throw new IllegalStateException("Failed: The authentication token was invalid.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.AUTHENTICATION_FAILED.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The authentication token was invalid.", e);
			}
		}
		try {
			api.deleteUser(adminAuthToken, null, usernames);
			throw new IllegalStateException("Failed: The client was null.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.SERVER_INVALID_CLIENT.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The client was null.", e);
			}
		}
		try {
			api.deleteUser(adminAuthToken, Controller.CLIENT, null);
			throw new IllegalStateException("Failed: The username list was null.");
		}
		catch(RequestErrorException e) {
			if(! ErrorCode.USER_INVALID_USERNAME.equals(e.getErrorCode())) {
				throw new IllegalArgumentException("Failed: The usernmae list was null.", e);
			}
		}
		try {
			api.deleteUser(adminAuthToken, Controller.CLIENT, usernames);
		}
		catch(ApiException e) {
			throw new IllegalArgumentException("Failed: Deleting the user.", e);
		}
	}
private void testUserDeletion ( final String adminAuthToken ) throws ApiException { Collection < String > usernames = new ArrayList < String > ( 1 ) ; usernames . add ( username ) ; try { api . deleteUser ( null , Controller . CLIENT , usernames ) ; throw new IllegalStateException ( "Failed: The authentication token was null." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . AUTHENTICATION_FAILED . equals ( e . getErrorCode ( ) ) ) { throw new IllegalArgumentException ( "Failed: The authentication token was null." , e ) ; } } try { api . deleteUser ( "Invalid token" , Controller . CLIENT , usernames ) ; throw new IllegalStateException ( "Failed: The authentication token was invalid." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . AUTHENTICATION_FAILED . equals ( e . getErrorCode ( ) ) ) { throw new IllegalArgumentException ( "Failed: The authentication token was invalid." , e ) ; } } try { api . deleteUser ( adminAuthToken , null , usernames ) ; throw new IllegalStateException ( "Failed: The client was null." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . SERVER_INVALID_CLIENT . equals ( e . getErrorCode ( ) ) ) { throw new IllegalArgumentException ( "Failed: The client was null." , e ) ; } } try { api . deleteUser ( adminAuthToken , Controller . CLIENT , null ) ; throw new IllegalStateException ( "Failed: The username list was null." ) ; } catch ( RequestErrorException e ) { if ( ! ErrorCode . USER_INVALID_USERNAME . equals ( e . getErrorCode ( ) ) ) { throw new IllegalArgumentException ( "Failed: The usernmae list was null." , e ) ; } } try { api . deleteUser ( adminAuthToken , Controller . CLIENT , usernames ) ; } catch ( ApiException e ) { throw new IllegalArgumentException ( "Failed: Deleting the user." , e ) ; } }
Tests user deletion and then deletes the user based on the class-level
 variables.
Tests user deletion and then deletes the user based on the class - level variables .
// Token is null. // Token is invalid. // Client is null. // Username list is null. // Deleting the user.