From c63cdb2444f10b53ac662cf7d80a4bff1c1ad85b Mon Sep 17 00:00:00 2001 From: David Syer Date: Tue, 27 Oct 2009 12:32:14 +0000 Subject: [PATCH] OPEN - issue SPR-6246: Velocity MethodInvocationExceptions not properly reported Added test case for exception. This probably fails on a non-Sun JVM? --- .../web/util/NestedServletExceptionTests.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 org.springframework.web.servlet/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java diff --git a/org.springframework.web.servlet/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java b/org.springframework.web.servlet/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java new file mode 100644 index 00000000000..9fb644ad7aa --- /dev/null +++ b/org.springframework.web.servlet/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java @@ -0,0 +1,24 @@ +package org.springframework.web.util; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.springframework.core.NestedExceptionUtils; + +public class NestedServletExceptionTests { + + @Test + public void testNestedServletExceptionString() { + NestedServletException exception = new NestedServletException("foo"); + assertEquals("foo", exception.getMessage()); + } + + @Test + public void testNestedServletExceptionStringThrowable() { + Throwable cause = new RuntimeException(); + NestedServletException exception = new NestedServletException("foo", cause); + assertEquals(NestedExceptionUtils.buildMessage("foo", cause), exception.getMessage()); + assertEquals(cause, exception.getCause()); + } + +}