Package org.apache.myfaces.test.mock

Examples of org.apache.myfaces.test.mock.MockFacesContext12


    @BeforeMethod
    protected void setUp() throws Exception
    {
        _mocksControl = EasyMock.createControl();
        _facesContext = new MockFacesContext12();
        _elContext = _mocksControl.createMock(ELContext.class);
        _facesContext.setELContext(_elContext);
        //_valueBinding = _mocksControl.createMock(ValueBinding.class);
        _valueExpression = _mocksControl.createMock(ValueExpression.class);
        _component = createComponent();
View Full Code Here


    @Override
    protected void setUp() throws Exception
    {
        _mocksControl = EasyMock.createControl();
        _facesContext = new MockFacesContext12();
        _application = _mocksControl.createMock(Application.class);
        _facesContext.setApplication(_application);
        //_expressionFactory = _mocksControl.createMock(ExpressionFactory.class);
        _elContext = new MockELContext();
        _elContext.putContext(FacesContext.class, _facesContext);
View Full Code Here

    @Override
    protected void setUp() throws Exception
    {
        _mocksControl = EasyMock.createControl();
        _externalContext = _mocksControl.createMock(ExternalContext.class);
        _facesContext = new MockFacesContext12(_externalContext);
        _testimpl = new TestViewHandler();
    }
View Full Code Here

    @BeforeMethod
    protected void setUp() throws Exception
    {
        _mocksControl = EasyMock.createControl();
        _facesContext = new MockFacesContext12();
        _elContext = _mocksControl.createMock(ELContext.class);
        _facesContext.setELContext(_elContext);
        //_valueBinding = _mocksControl.createMock(ValueBinding.class);
        _valueExpression = _mocksControl.createMock(ValueExpression.class);
        _component = createComponent();
View Full Code Here

     * Test method for {@link org.apache.myfaces.el.convert.ValueBindingToValueExpression#getExpectedType()}.
     */
    public void testGetExpectedType()
    {
        Object expectedValue = new Date();
        facesContext = new MockFacesContext12();
        expect(binding.getValue(eq(facesContext))).andReturn(expectedValue);
        mockControl.replay();
        assertEquals(Date.class, testimpl.getExpectedType());
        mockControl.verify();
    }
View Full Code Here

    private MockFacesContext12 context;

    protected void setUp() throws Exception
    {
        app = new ApplicationImpl(new RuntimeConfig());
        context = new MockFacesContext12();
    }
View Full Code Here

    public void testContextCreated()
    {
        FacesELContextListener listener = new FacesELContextListener();
        IMocksControl mockControl = EasyMock.createControl();
        ELContext elctx = mockControl.createMock(ELContext.class);
        MockFacesContext12 facesctx = new MockFacesContext12();
        Application app = mockControl.createMock(Application.class);
        facesctx.setApplication(app);
        ELContextEvent event = mockControl.createMock(ELContextEvent.class);
        expect(event.getELContext()).andReturn(elctx);
        elctx.putContext(eq(FacesContext.class), same(facesctx));
        ELContextListener elctxListener = mockControl.createMock(ELContextListener.class);
        expect(app.getELContextListeners()).andReturn(new ELContextListener[] { elctxListener });
View Full Code Here

     */
    @Test
    public void testErrorMessage()
    {
        UIViewRoot root = new UIViewRoot();
        MockFacesContext12 facesContext = new MockFacesContext12();
        IMocksControl mocksControl = EasyMock.createControl();
        Application application = mocksControl.createMock(Application.class);
        ViewHandler viewHandler = mocksControl.createMock(ViewHandler.class);
        ELContext elContext = mocksControl.createMock(ELContext.class);
        ExpressionFactory expressionFactory = mocksControl.createMock(ExpressionFactory.class);
        ValueExpression valueExpression = mocksControl.createMock(ValueExpression.class);
        facesContext.setApplication(application);
        facesContext.setViewRoot(root);
        facesContext.setELContext(elContext);
       
        expect(application.getViewHandler()).andReturn(viewHandler);
        expect(viewHandler.calculateLocale(facesContext)).andReturn(Locale.ENGLISH);
        expect(application.getMessageBundle()).andReturn("javax.faces.Messages");
        expect(application.getExpressionFactory()).andReturn(expressionFactory);
View Full Code Here

     * Test method for {@link org.apache.myfaces.el.convert.ValueBindingToValueExpression#getExpectedType()}.
     */
    public void testGetExpectedType()
    {
        Object expectedValue = new Date();
        facesContext = new MockFacesContext12();
        expect(binding.getValue(eq(facesContext))).andReturn(expectedValue);
        mockControl.replay();
        assertEquals(Date.class, testimpl.getExpectedType());
        mockControl.verify();
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception
    {
        _mocksControl = EasyMock.createControl();
        _facesContext = new MockFacesContext12();
        _application = _mocksControl.createMock(Application.class);
        _facesContext.setApplication(_application);
        //_expressionFactory = _mocksControl.createMock(ExpressionFactory.class);
        _elContext = new MockELContext();
        _elContext.putContext(FacesContext.class, _facesContext);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.test.mock.MockFacesContext12

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.