package at.fhj.itm.dao;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import java.sql.Connection;
import java.util.Date;
import java.util.UUID;
import org.junit.Test;
import at.fhj.itm.model.Location;
import at.fhj.itm.model.User;
public class EasyMockTest
{
@Test
public void testInsert() throws DAOException
{
// Configure mock object
UserDAO mock = createMock(UserDAO.class);
Connection mockConnection = createMock(Connection.class);
Location location = new Location(1234, "Unit City");
User p = new User("Unit", "Test", "UnitTest", "1234", "Unit@Test.com",
"123456", location, new Date(), UUID.randomUUID().toString()
.replace("-", ""));
mock.update(p,mockConnection);
replay(mock);
// Run test case
mock.update(p,mockConnection);
// Verify mock interactions
verify(mock);
}
}