package edu.duke.cabig.c3pr.domain;

import edu.duke.cabig.c3pr.AbstractTestCase;
import edu.duke.cabig.c3pr.utils.UserCreationHelper;

public class UserTestCase extends AbstractTestCase{
	
	private User user ;
	private UserCreationHelper userCreationHelper = new UserCreationHelper();
	public void setUserCreationHelper(UserCreationHelper userCreationHelper) {
		this.userCreationHelper = userCreationHelper;
	}

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		user = userCreationHelper.buildBasicResearchStaffUser();
	}
	
	public void testResetToken(){
		
	}
	
	public void testGetPasswordAge(){
		
	}
	
	public void testAddPasswordToHistory(){
		
	}
	
	public void testGetLastFirst(){
		assertEquals("getLastFirst should evaluate to Scott, John","Scott, John",user.getLastFirst());
	}
	
	public void testGetFullName(){
		assertEquals("getLastFirst should evaluate to John Scott","John Scott",user.getFullName());
	}
}

@@ -30,16 +30,67 @@
 omain;%0A%0A
+import java.sql.Timestamp;%0Aimport java.util.Date;%0A%0A
 import e
@@ -630,100 +630,1229 @@
 %7B%0A%09%09
-%0A%09%7D%0A%09%0A%09public void testGetPasswordAge()%7B%0A%09%09%0A%09%7D%0A%09%0A%09public void testAddPasswordToHistory()%7B%0A%09%09
+Timestamp timestamp = new Timestamp(200);%0A%09%09user.setTokenTime(timestamp);%0A%09%09user.resetToken();%0A%09%09assertNotEquals(%22after reset token time, time stamp should be differnt then earlier%22, timestamp, user.getTokenTime());%0A%09%7D%0A%09%0A%09public void testGetPasswordAge()%7B%0A        Timestamp timestamp = new Timestamp(new Date().getTime() - 1000);%0A%09%09user.setPasswordLastSet(timestamp);%0A%09%09System.out.println(%22######## : %22 + user.getPasswordAge());%0A%09%09assertEquals(%22password age is 1000 miliseconds%22, 1000, user.getPasswordAge());%0A%09%7D%0A%09%0A%09public void testAddPasswordToHistory()%7B%0A%09%09assertEquals(%22password history size is 0%22, 0, user.getPasswordHistory().size());%0A%09%09user.addPasswordToHistory(%22testpasswd%22, 1)%09;%0A%09%09assertEquals(%22password history size is 1%22, 1, user.getPasswordHistory().size());%0A%09%7D%0A%09%0A%09public void testAddPasswordToHistory1()%7B%0A%09%09assertEquals(%22password history size is 0%22, 0, user.getPasswordHistory().size());%0A%09%09user.addPasswordToHistory(%22testpasswd%22, 1)%09;%0A%09%09user.addPasswordToHistory(%22testpasswd2%22, 1)%09;%0A%09%09assertEquals(%22password history size is 1%22, 1, user.getPasswordHistory().size());%0A%09%09assertEquals(%22last stored password should be testpasswd2%22, %22testpasswd2%22, user.getPasswordHistory().get(user.getPasswordHistory().size() -1));
 %0A%09%7D%0A
@@ -2117,10 +2117,12 @@
 ());%0A%09%7D%0A
+%09%0A
 %7D%0A

test case coverage improvement