Package org.apache.click

Examples of org.apache.click.MockContext


    protected void tearDown() throws Exception {
        Locale.setDefault(defaultLocale);
    }

    public void testOnProcess() {
        MockContext mockContext = MockContext.initContext();
        MockRequest request = mockContext.getMockRequest();

        DoubleField doubleField = new DoubleField("id");
        assertEquals("id", doubleField.getName());
       
        assertEquals(new Double(Double.POSITIVE_INFINITY), new Double(doubleField.getMaxValue()));
View Full Code Here


        assertEquals("-20.1", doubleField.getValue());
        assertEquals(new Double(-20.1), doubleField.getValueObject());
    }

    public void testLocaleServerENClientDE() {
        MockContext mockContext = MockContext.initContext(Locale.GERMANY);
        MockRequest request = mockContext.getMockRequest();

        DoubleField doubleField = new DoubleField("id");

        // German uses ',' as the decimal separator
        // German 123,4 => double 123.4
View Full Code Here

import org.apache.click.servlet.MockRequest;

public class TelephoneFieldTest extends TestCase {
   
    public void testOnProcess() {
        MockContext mockContext = MockContext.initContext();
        MockRequest request = mockContext.getMockRequest();
       
        TelephoneField telephoneField = new TelephoneField("telephone");
        assertEquals("telephone", telephoneField.getName());
       
        request.getParameterMap().put("telephone", "02 8734 7653");
View Full Code Here

* @author Malcolm Edgar
*/
public class DateFieldTest extends TestCase {

    public void testNullParameter() {
        MockContext mockContext = MockContext.initContext();
        MockRequest request = mockContext.getMockRequest();

        DateField dateField = new DateField("dateField");
        assertEquals("dateField", dateField.getName());
       
        request.getParameterMap().put("dateField", "");       
View Full Code Here

     * value each time.
     *
     * CLK-316
     */
    public void testIntegerCacheValue() {
        MockContext mockContext = MockContext.initContext();
        MockRequest request = mockContext.getMockRequest();
       
        DateField dateField = new DateField("dateField");
        dateField.setFormatPattern("dd MMM yyyy H m s S");
        String requestParam = "06 Oct 2008 2 30 59 999";
        request.getParameterMap().put("dateField", requestParam);
View Full Code Here

import org.apache.click.servlet.MockRequest;

public class LongFieldTest extends TestCase {
   
    public void testOnProcess() {
        MockContext mockContext = MockContext.initContext();
        MockRequest request = mockContext.getMockRequest();
       
        LongField longField = new LongField("id");
        assertEquals("id", longField.getName());

        request.getParameterMap().put("id", "1234");
View Full Code Here

        assertFalse(pat.matcher("#A2A2A").matches());
        assertFalse(pat.matcher("#1234").matches());
    }
   
    public void testValidate() {
        MockContext mockContext = MockContext.initContext();
        MockRequest mr = mockContext.getMockRequest();
        Map paras = mr.getParameterMap();
       
        ColorPicker cp = new ColorPicker("color");
       
        paras.put("color","#fff");
View Full Code Here

import org.apache.click.servlet.MockRequest;

public class EmailFieldTest extends TestCase {

    public void testOnProcess() {
        MockContext mockContext = MockContext.initContext();
        MockRequest request = mockContext.getMockRequest();
       
        EmailField emailField = new EmailField("email");
        assertEquals("email", emailField.getName());
       
        request.getParameterMap().put("email", "username@server.com");
View Full Code Here

            "three",
            "3.1"};
    }
   
    private void assertExpandOrCollapse(Tree tree, String[] nodeIds, boolean expected) {
        MockContext context = (MockContext) MockContext.getThreadLocalContext();
        for(int i = 0; i < nodeIds.length; i++) {
            TreeNode node = tree.find(nodeIds[i]);
            assertTrue("IsExpanded must be " + expected,node.isExpanded() == expected);
        }
        tree.onProcess();
        context.fireActionEventsAndClearRegistry();
        for(int i = 0; i < nodeIds.length; i++) {
            TreeNode node = tree.find(nodeIds[i]);
            assertTrue("IsExpanded must be " + !expected,node.isExpanded() == !expected);
        }
    }
View Full Code Here

            assertTrue("IsExpanded must be " + !expected,node.isExpanded() == !expected);
        }
    }

    private void assertSelectOrDeselect(Tree tree, String[] nodeIds, boolean expected) {
        MockContext context = (MockContext) MockContext.getThreadLocalContext();
        for(int i = 0; i < nodeIds.length; i++) {
            TreeNode node = tree.find(nodeIds[i]);
            assertTrue("IsExpanded must be " + expected,node.isSelected() == expected);
        }
        tree.onProcess();
        context.fireActionEventsAndClearRegistry();
        for(int i = 0; i < nodeIds.length; i++) {
            TreeNode node = tree.find(nodeIds[i]);
            assertTrue("IsExpanded must be " + !expected,node.isSelected() == !expected);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.click.MockContext

Copyright © 2018 www.massapicom. 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 coftware#gmail.com.