package org.richfaces.component; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import java.io.IOException; import java.net.MalformedURLException; import org.hamcrest.Matcher; import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; /** * Test for dynamic add/remove {@link UIScripts} as view resource. * * @author asmirnov * */ public class AjaxValidationTest extends IntegrationTestBase { protected String getFacesConfig() { return "faces-config.xml"; } protected String getPageName() { return "test"; } @Test public void testRequest() throws Exception { HtmlPage page = requestPage(); HtmlInput input = getInput(page); assertNotNull(input); } @Test public void testSubmitTooShortValue() throws Exception { submitValueAndCheckMessage("", not(equalTo(""))); } @Test public void testSubmitTooLongValue() throws Exception { submitValueAndCheckMessage("123456", not(equalTo(""))); } @Test public void testSubmitProperValue() throws Exception { submitValueAndCheckMessage("ab", equalTo("")); } }