package com.intel.media.mts.action.user;

import org.junit.Assert;
import org.junit.Test;

import com.intel.media.mts.action.ActionTestSupport;
import com.intel.media.mts.model.User;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionProxy;

public class DeleteUserActionTest extends ActionTestSupport<DeleteUserAction> {
	
	@Test
	public void testDeleteUser(){
		ActionProxy proxy = getActionProxy("/deleteUserAction.action");
		Assert.assertNotNull(proxy);
		
		DeleteUserAction action = (DeleteUserAction)proxy.getAction();
		Assert.assertNotNull(action);
		
		User u = action.getUserService().findById(1);
		action.setUser(u);
		
		try {
			String result = proxy.execute();
			Assert.assertEquals(Action.SUCCESS, result);
		} catch (Exception e) {
			e.printStackTrace();
			Assert.fail("DeleteUserAction");
		}
	}
}
