diff --git a/impl/extension/jsf/src/test/java/exception/handler/redirect/ExceptionWithCorrectRedirect.java b/impl/extension/jsf/src/test/java/exception/handler/redirect/ExceptionWithCorrectRedirect.java
new file mode 100644
index 0000000..66ec2c6
--- /dev/null
+++ b/impl/extension/jsf/src/test/java/exception/handler/redirect/ExceptionWithCorrectRedirect.java
@@ -0,0 +1,15 @@
+package exception.handler.redirect;
+
+import br.gov.frameworkdemoiselle.annotation.Redirect;
+import br.gov.frameworkdemoiselle.exception.ApplicationException;
+
+@Redirect(viewId="/redirect.jsf")
+@ApplicationException
+public class ExceptionWithCorrectRedirect extends RuntimeException{
+
+ private static final long serialVersionUID = 1L;
+
+ public ExceptionWithCorrectRedirect(String msg) {
+ super(msg);
+ }
+}
diff --git a/impl/extension/jsf/src/test/java/exception/handler/redirect/ExceptionWithWrongRedirect.java b/impl/extension/jsf/src/test/java/exception/handler/redirect/ExceptionWithWrongRedirect.java
new file mode 100644
index 0000000..f000481
--- /dev/null
+++ b/impl/extension/jsf/src/test/java/exception/handler/redirect/ExceptionWithWrongRedirect.java
@@ -0,0 +1,15 @@
+package exception.handler.redirect;
+
+import br.gov.frameworkdemoiselle.annotation.Redirect;
+import br.gov.frameworkdemoiselle.exception.ApplicationException;
+
+@Redirect(viewId="/inexist.jsf")
+@ApplicationException
+public class ExceptionWithWrongRedirect extends RuntimeException{
+
+ private static final long serialVersionUID = 1L;
+
+ public ExceptionWithWrongRedirect(String msg) {
+ super(msg);
+ }
+}
diff --git a/impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectBean.java b/impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectBean.java
new file mode 100644
index 0000000..722cbb4
--- /dev/null
+++ b/impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectBean.java
@@ -0,0 +1,20 @@
+package exception.handler.redirect;
+
+import br.gov.frameworkdemoiselle.stereotype.ViewController;
+
+@ViewController
+public class RedirectBean {
+
+ private String redirectCorrectPage = "Correct Redirect Exception!";
+
+ private String redirectWrongPage = "Wrong Redirect Exception!";
+
+ public String getRedirectCorrectPage() {
+ throw new ExceptionWithCorrectRedirect(redirectCorrectPage);
+ }
+
+ public String getRedirectWrongPage() {
+ throw new ExceptionWithWrongRedirect(redirectWrongPage);
+ }
+
+}
diff --git a/impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectExceptionTest.java b/impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectExceptionTest.java
new file mode 100644
index 0000000..08a6eeb
--- /dev/null
+++ b/impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectExceptionTest.java
@@ -0,0 +1,78 @@
+package exception.handler.redirect;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import test.Tests;
+
+@RunWith(Arquillian.class)
+public class RedirectExceptionTest {
+
+ @ArquillianResource
+ private URL deploymentUrl;
+
+ private static final String PATH = "src/test/resources/exception-handler-redirect";
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ return Tests.createDeployment().addClass(RedirectExceptionTest.class)
+ .addClass(RedirectBean.class)
+ .addClass(ExceptionWithCorrectRedirect.class)
+ .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml")
+ .addAsWebResource(Tests.createFileAsset(PATH + "/page.xhtml"), "page.xhtml")
+ .addAsWebResource(Tests.createFileAsset(PATH + "/redirect.xhtml"), "redirect.xhtml")
+ .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml");
+ }
+
+ @Test
+ public void handleExceptionWithCorrectRedirect() {
+ HttpClient client = new HttpClient();
+ GetMethod method = new GetMethod(deploymentUrl + "/index.jsf");
+
+ try {
+ int status = client.executeMethod(method);
+ String message = method.getResponseBodyAsString();
+
+ assertEquals(HttpStatus.SC_OK, status);
+ assertFalse(message.contains("Correct Redirect Exception!"));
+ assertTrue(message.contains("Page redirected!"));
+
+ } catch (HttpException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void handleExceptionWithWrongRedirect() {
+ HttpClient client = new HttpClient();
+ GetMethod method = new GetMethod(deploymentUrl + "/page.jsf");
+
+ try {
+ int status = client.executeMethod(method);
+ assertEquals(HttpStatus.SC_NOT_FOUND, status);
+
+ } catch (HttpException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
+
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect/index.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-redirect/index.xhtml
new file mode 100644
index 0000000..7cd2a05
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect/index.xhtml
@@ -0,0 +1,9 @@
+
+
+
+ #{redirectBean.redirectCorrectPage}
+
+
+
+
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect/page.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-redirect/page.xhtml
new file mode 100644
index 0000000..5beea92
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect/page.xhtml
@@ -0,0 +1,9 @@
+
+
+
+ #{redirectBean.redirectWrongPage}
+
+
+
+
\ No newline at end of file
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect/redirect.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-redirect/redirect.xhtml
new file mode 100644
index 0000000..ae2b404
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect/redirect.xhtml
@@ -0,0 +1,9 @@
+
+
+
+ Page redirected!
+
+
+
+
\ No newline at end of file
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect/web.xml b/impl/extension/jsf/src/test/resources/exception-handler-redirect/web.xml
new file mode 100644
index 0000000..b8a230d
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect/web.xml
@@ -0,0 +1,74 @@
+
+
+
+
+ br.gov.frameworkdemoiselle.util.ServletListener
+
+
+ Demoiselle Servlet Filter
+ br.gov.frameworkdemoiselle.util.ServletFilter
+
+
+ Demoiselle Servlet Filter
+ /*
+
+
+
+ Pretty Filter
+ com.ocpsoft.pretty.PrettyFilter
+
+
+
+ Pretty Filter
+ /*
+ FORWARD
+ REQUEST
+ ERROR
+
+
+
+ Faces Servlet
+ javax.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ *.jsf
+
+
\ No newline at end of file
--
libgit2 0.21.2