Source:
<code>public void testActivityLogEntryClass() { ______TS("Test constructors and generateLogMessage"); String logMessage = "TEAMMATESLOG|||instructorHome|||Pageload|||true|||Instructor|||UserName|||UserId" + "|||UserEmail|||Message|||URL"; AccountAttributes acc = new AccountAttributes("UserId", "UserName", true, "UserEmail", "UserInstitute"); <START> UserType userType = new GateKeeper().getCurrentUser(); <END> ActivityLogEntry entry = new ActivityLogEntry("instructorHome", "Pageload", acc, "Message", "URL", userType); AssertHelper.assertLogMessageEquals(logMessage, entry.generateLogMessage()); logMessage = "TEAMMATESLOG|||instructorHome|||Pageload|||true|||Instructor|||UserName|||UserId" + "|||UserEmail|||Message|||URL|||UserId20151019143729608"; AppLogLine appLog = new AppLogLine(); appLog.setLogMessage(logMessage); entry = new ActivityLogEntry(appLog); assertEquals(logMessage, entry.generateLogMessage()); logMessage = "TEAMMATESLOG|||instructorHome|||Unknown|||true|||Unknown|||Unknown|||Unknown|||Unknown" + "|||<span class=\"text-danger\">Error. ActivityLogEntry object is not created " + "for this servlet action.</span><br>Message|||URL"; entry = new ActivityLogEntry("instructorHome", "Message", "URL"); AssertHelper.assertLogMessageEquals(logMessage, entry.generateLogMessage()); ______TS("Test getters"); appLog.setTimeUsec(0); entry = new ActivityLogEntry(appLog); assertEquals("<a href=\"URL?user=UserId\" class=\"text-success bold\" target=\"_blank\">instructorHome</a>", entry.getActionInfo()); assertEquals("01-01-1970 07:30:00", entry.getDateInfo()); assertEquals("Message", entry.getMessageInfo()); assertEquals("UserId", entry.getPersonInfo()); assertEquals("Instructor", entry.getRole()); }</code><technical_language>I do need GateKeeper here. test it, custom UserType object</technical_language>

Target:
public void testActivityLogEntryClass() { ______TS("Test constructors and generateLogMessage"); String logMessage = "TEAMMATESLOG|||instructorHome|||Pageload|||true|||Instructor|||UserName|||UserId" + "|||UserEmail|||Message|||URL"; AccountAttributes acc = new AccountAttributes("UserId", "UserName", true, "UserEmail", "UserInstitute"); UserType userType = new UserType("googleId"); ActivityLogEntry entry = new ActivityLogEntry("instructorHome", "Pageload", acc, "Message", "URL", userType); AssertHelper.assertLogMessageEquals(logMessage, entry.generateLogMessage()); logMessage = "TEAMMATESLOG|||instructorHome|||Pageload|||true|||Instructor|||UserName|||UserId" + "|||UserEmail|||Message|||URL|||UserId20151019143729608"; AppLogLine appLog = new AppLogLine(); appLog.setLogMessage(logMessage); entry = new ActivityLogEntry(appLog); assertEquals(logMessage, entry.generateLogMessage()); logMessage = "TEAMMATESLOG|||instructorHome|||Unknown|||true|||Unknown|||Unknown|||Unknown|||Unknown" + "|||<span class=\"text-danger\">Error. ActivityLogEntry object is not created " + "for this servlet action.</span><br>Message|||URL"; entry = new ActivityLogEntry("instructorHome", "Message", "URL"); AssertHelper.assertLogMessageEquals(logMessage, entry.generateLogMessage()); ______TS("Test getters"); appLog.setTimeUsec(0); entry = new ActivityLogEntry(appLog); assertEquals("<a href=\"URL?user=UserId\" class=\"text-success bold\" target=\"_blank\">instructorHome</a>", entry.getActionInfo()); assertEquals("01-01-1970 07:30:00", entry.getDateInfo()); assertEquals("Message", entry.getMessageInfo()); assertEquals("UserId", entry.getPersonInfo()); assertEquals("Instructor", entry.getRole()); }