diff --git a/jee7/pom.xml b/jee7/pom.xml
index addb586b74..e398651055 100644
--- a/jee7/pom.xml
+++ b/jee7/pom.xml
@@ -98,7 +98,16 @@
shrinkwrap-resolver-impl-maven-archive
test
-
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5
+
+
+ commons-io
+ commons-io
+ 2.4
+
com.sun.faces
jsf-api
@@ -378,5 +387,21 @@
+
+ webdriver-chrome
+
+ true
+
+
+ chrome
+
+
+
+
+ webdriver-firefox
+
+ firefox
+
+
diff --git a/jee7/src/main/webapp/ConvListVal.xhtml b/jee7/src/main/webapp/ConvListVal.xhtml
index e5425e87a5..8c5213764c 100644
--- a/jee7/src/main/webapp/ConvListVal.xhtml
+++ b/jee7/src/main/webapp/ConvListVal.xhtml
@@ -8,7 +8,7 @@
Testing converters
-
+
@@ -19,13 +19,13 @@
-
+
-
+
-
+
@@ -41,7 +41,7 @@
-
+
diff --git a/jee7/src/main/webapp/WEB-INF/faces-config.xml b/jee7/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000000..d5b2cd6612
--- /dev/null
+++ b/jee7/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,13 @@
+
+
+
+ convListVal
+ com.baeldung.convListVal.ConvListVal
+ session
+
+
\ No newline at end of file
diff --git a/jee7/src/main/webapp/WEB-INF/web.xml b/jee7/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..11bd87cf99
--- /dev/null
+++ b/jee7/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ Faces Servlet
+ javax.faces.webapp.FacesServlet
+
+
+ Faces Servlet
+ *.jsf
+
+
+ javax.faces.PROJECT_STAGE
+ Development
+
+
+ State saving method: 'client' or 'server' (default). See JSF Specification section 2.5.2
+ javax.faces.STATE_SAVING_METHOD
+ client
+
+
+
+ index.jsf
+ welcome.jsf
+ index.html
+ index.jsp
+
+
\ No newline at end of file
diff --git a/jee7/src/test/java/com/baeldung/convListVal/ConvListValTest.java b/jee7/src/test/java/com/baeldung/convListVal/ConvListValTest.java
new file mode 100644
index 0000000000..4450a26f43
--- /dev/null
+++ b/jee7/src/test/java/com/baeldung/convListVal/ConvListValTest.java
@@ -0,0 +1,101 @@
+package com.baeldung.convListVal;
+
+import static org.jboss.arquillian.graphene.Graphene.guardHttp;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+@RunWith(Arquillian.class)
+public class ConvListValTest {
+
+ @ArquillianResource
+ private URL deploymentUrl;
+
+ private static final String WEBAPP_SRC = "src/main/webapp";
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ return ( ShrinkWrap.create(
+ WebArchive.class, "jee7.war").
+ addClasses(ConvListVal.class, MyListener.class)).
+ addAsWebResource(new File(WEBAPP_SRC, "ConvListVal.xhtml")).
+ addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Drone
+ WebDriver browser;
+
+ @ArquillianResource
+ URL contextPath;
+
+ @FindBy(id="myForm:age")
+ private WebElement ageInput;
+
+ @FindBy(id="myForm:average")
+ private WebElement averageInput;
+
+ @FindBy(id="myForm:send")
+ private WebElement sendButton;
+
+ @Test
+ @RunAsClient
+ public void givenAge_whenAgeInvalid_thenErrorMessage() throws Exception {
+ browser.get(deploymentUrl.toExternalForm() + "ConvListVal.jsf");
+ ageInput.sendKeys("stringage");
+ guardHttp(sendButton).click();
+ Assert.assertTrue("Show Age error message", browser.findElements(By.id("myForm:ageError")).size() > 0);
+ }
+
+ @Test
+ @RunAsClient
+ public void givenAverage_whenAverageInvalid_thenErrorMessage() throws Exception {
+ browser.get(deploymentUrl.toExternalForm() + "ConvListVal.jsf");
+ averageInput.sendKeys("stringaverage");
+ guardHttp(sendButton).click();
+ Assert.assertTrue("Show Average error message", browser.findElements(By.id("myForm:averageError")).size() > 0);
+ }
+
+ @Test
+ @RunAsClient
+ public void givenDate_whenDateInvalid_thenErrorMessage() throws Exception {
+ browser.get(deploymentUrl.toExternalForm() + "ConvListVal.jsf");
+ averageInput.sendKeys("123");
+ guardHttp(sendButton).click();
+ Assert.assertTrue("Show Date error message", browser.findElements(By.id("myForm:myDateError")).size() > 0);
+ }
+
+ @Test
+ @RunAsClient
+ public void givenSurname_whenSurnameMinLenghtInvalid_thenErrorMessage() throws Exception {
+ browser.get(deploymentUrl.toExternalForm() + "ConvListVal.jsf");
+ averageInput.sendKeys("aaa");
+ guardHttp(sendButton).click();
+ Assert.assertTrue("Show Surname error message", browser.findElements(By.id("myForm:surnameError")).size() > 0);
+ }
+
+ @Test
+ @RunAsClient
+ public void givenSurname_whenSurnameMaxLenghtInvalid_thenErrorMessage() throws Exception {
+ browser.get(deploymentUrl.toExternalForm() + "ConvListVal.jsf");
+ averageInput.sendKeys("aaaaabbbbbc");
+ guardHttp(sendButton).click();
+ Assert.assertTrue("Show Surname error message", browser.findElements(By.id("myForm:surnameError")).size() > 0);
+ }
+
+}