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 0000000000..9fb644ad7a --- /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()); + } + +}