Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

error templates done

  • Loading branch information...
commit e851ee9f48dbfe60dd1c3cb22794e0a38e4a795f 1 parent 7f4d5c9
@gregjan gregjan authored
10 forms/src/test/java/
@@ -1,16 +1,17 @@
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.reset;
import java.util.Date;
import javax.annotation.Resource;
import javax.mail.internet.MimeMessage;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
@@ -91,6 +92,11 @@ public void testDepositError() {
DepositResult result = new DepositResult();
+ Throwable exception = new Exception("example error trace").fillInStackTrace();
+ StringWriter sw = new StringWriter();
+ exception.printStackTrace(new PrintWriter(sw));
+ result.setResponseBody(sw.toString());
emailNotificationHandler.notifyError(form, result, "", "test");
verify(this.javaMailSender, times(1)).send(any(MimeMessage.class));
6 forms/src/test/resources/DepositErrorHtml.ftl
@@ -24,8 +24,10 @@
<img style="float: right;" alt="UNC Libraries logo" src="${siteUrl}/static/images/email_logo.png"/>
- <p>An unrecoverable error occurred on ${form.title} at ${receivedDate?datetime}.
- Please do not reply to this message.
+ <p>An unrecoverable error occurred on ${form.title} at ${receivedDate?datetime}:</p>
+ <pre>
+${result.getResponseBody()!"no response body"}
+ </pre>
<p>The following information was entered on <a href="${siteUrl}/forms/${formId}.form">${form.title}</a>:
<li>Depositor Username: ${form.currentUser}</li>
8 forms/src/test/resources/DepositErrorText.ftl
@@ -15,8 +15,12 @@
limitations under the License.
-An unrecoverable error occurred on ${form.title} at ${receivedDate?datetime}.
-Please do not reply to this message.
+An unrecoverable error occurred on ${form.title} at ${receivedDate?datetime}:
+response body____________________________
+${result.getResponseBody()!"no response body"}
The following information was entered on ${siteUrl}/forms/${formId}.form
* Depositor Username: ${form.currentUser}
* Depositor Email: ${depositorEmail!"not available"}
Please sign in to comment.
Something went wrong with that request. Please try again.