Source:
<code>public void testSystemCrashReportEmailContent() throws IOException { ______TS("user is logged in and the error has message"); AssertionError error = new AssertionError("invalid parameter"); String requestMethod = "GET"; String requestUserAgent = "user-agent"; String requestPath = "/page/studentHome"; String requestUrl = "/page/studentHome/"; String requestParam = "{}"; UserType userType = new UserType("Actual user ABC"); EmailWrapper email = new EmailGenerator().generateSystemErrorEmail(requestMethod, requestUserAgent, requestPath, requestUrl, requestParam, userType, error); String lastCommonLineRegex = "(?s)(at org\\.testng\\.TestRunner\\.run\\(TestRunner\\.java:617\\)\\s*)at.*?(\\s*</code>)"; String modifiedContent = email.getContent().replaceAll(lastCommonLineRegex, "$1...$2"); email.setContent(modifiedContent); String subject = String.format(EmailType.ADMIN_SYSTEM_ERROR.getSubject(), Config.getAppVersion(), error.getMessage()); verifyEmail(email, Config.SUPPORT_EMAIL, subject, "/systemCrashReportEmail.html"); ______TS("user is not logged in and the error has no message"); error = new AssertionError(); email = new EmailGenerator().generateSystemErrorEmail(requestMethod, requestUserAgent, requestPath, requestUrl, requestParam, null, error); subject = String.format(EmailType.ADMIN_SYSTEM_ERROR.getSubject(), Config.getAppVersion(), "java.lang.AssertionError"); modifiedContent = email.getContent().replaceAll(lastCommonLineRegex, "$1...$2"); email.setContent(modifiedContent); <START> verifyEmail(email, Config.SUPPORT_EMAIL, subject, "/systemCrashReportEmail2.html"); <END> }</code><technical_language>A minor point ignore this if want, try of a name suffixing 2 behind, if possible</technical_language>

Target:
public void testSystemCrashReportEmailContent() throws IOException { ______TS("user is logged in and the error has message"); AssertionError error = new AssertionError("invalid parameter"); String requestMethod = "GET"; String requestUserAgent = "user-agent"; String requestPath = "/page/studentHome"; String requestUrl = "/page/studentHome/"; String requestParam = "{}"; UserType userType = new UserType("Actual user ABC"); EmailWrapper email = new EmailGenerator().generateSystemErrorEmail(requestMethod, requestUserAgent, requestPath, requestUrl, requestParam, userType, error); String lastCommonLineRegex = "(?s)(at org\\.testng\\.TestRunner\\.run\\(TestRunner\\.java:617\\)\\s*)at.*?(\\s*</code>)"; String modifiedContent = email.getContent().replaceAll(lastCommonLineRegex, "$1...$2"); email.setContent(modifiedContent); String subject = String.format(EmailType.ADMIN_SYSTEM_ERROR.getSubject(), Config.getAppVersion(), error.getMessage()); verifyEmail(email, Config.SUPPORT_EMAIL, subject, "/systemCrashReportEmail.html"); ______TS("user is not logged in and the error has no message"); error = new AssertionError(); email = new EmailGenerator().generateSystemErrorEmail(requestMethod, requestUserAgent, requestPath, requestUrl, requestParam, null, error); subject = String.format(EmailType.ADMIN_SYSTEM_ERROR.getSubject(), Config.getAppVersion(), "java.lang.AssertionError"); modifiedContent = email.getContent().replaceAll(lastCommonLineRegex, "$1...$2"); email.setContent(modifiedContent); verifyEmail(email, Config.SUPPORT_EMAIL, subject, "/systemCrashReportEmailLessInfo.html"); }