Package org.richfaces.component

Source Code of org.richfaces.component.GraphValidationTest

package org.richfaces.component;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertNotNull;


import org.junit.Test;

import com.gargoylesoftware.htmlunit.html.HtmlElement;
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 GraphValidationTest extends IntegrationTestBase {

    protected String getFacesConfig() {
        return "graph-faces-config.xml";

    protected String getPageName() {
        return "graph-test";

    public void testRequest() throws Exception {
        HtmlPage page = requestPage();
        HtmlInput input = getInput(page);

    protected HtmlPage submit(HtmlPage page) throws IOException {
        HtmlElement submit = (HtmlElement) page.getElementById("form:submit");

    public void testSubmitTooShortValue() throws Exception {
        HtmlPage page = submitValueAndCheckMessage("", containsString(GraphBean.SHORT_MSG));
        checkMessage(page, "textMessage", containsString(GraphBean.SHORT_MSG));
        checkMessage(page, "graphMessage", equalTo(""));

    public void testBeanLevelConstrain() throws Exception {
        HtmlPage page = submitValueAndCheckMessage("bar", equalTo(GraphBean.FOO_MSG));
        checkMessage(page, "graphMessage", containsString(GraphBean.FOO_MSG));
        checkMessage(page, "textMessage", equalTo(""));

    public void testCorrectValue() throws Exception {
        submitValueAndCheckMessage("foobar", equalTo(""));

Related Classes of org.richfaces.component.GraphValidationTest

Copyright © 2018 All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact