protected LocalParameterMap parameters() { MockParameterMap map = new MockParameterMap(); map.put("prop", "value"); return map; }
protected LocalParameterMap blankParameters() { MockParameterMap map = new MockParameterMap(); map.put("prop", ""); return map; }
public final void testUserEventQueued_GETRefresh() { MockParameterMap requestParameterMap = new MockParameterMap(); requestParameterMap.put("execution", "e1s1"); EasyMock.expect(this.context.getRequestParameters()).andStubReturn(requestParameterMap); EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope); JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context); assertFalse("No user event should be queued", createdView.userEventQueued()); }
public void testMultipleFormObjects() throws Exception { MockRequestContext context = new MockRequestContext(parameters()); FormAction action1 = createFormAction("test1"); action1.setupForm(context); TestBean test1 = (TestBean) context.getFlowScope().get("test1"); assertNotNull(test1); assertSame(test1, new FormObjectAccessor(context).getCurrentFormObject()); FormAction action2 = createFormAction("test2"); action2.setupForm(context); TestBean test2 = (TestBean) context.getFlowScope().get("test2"); assertNotNull(test2); assertSame(test2, new FormObjectAccessor(context).getCurrentFormObject()); MockParameterMap parameters = new MockParameterMap(); parameters.put("prop", "12345"); context.setExternalContext(new MockExternalContext(parameters)); action1.bindAndValidate(context); TestBean test11 = (TestBean) context.getFlowScope().get("test1"); assertSame(test1, test11); assertEquals("12345", test1.getProp()); assertSame(test1, new FormObjectAccessor(context).getCurrentFormObject()); parameters = new MockParameterMap(); parameters.put("prop", "123456"); context.setExternalContext(new MockExternalContext(parameters)); action2.bindAndValidate(context); TestBean test22 = (TestBean) context.getFlowScope().get("test2"); assertSame(test22, test2); assertEquals("123456", test2.getProp()); assertSame(test2, new FormObjectAccessor(context).getCurrentFormObject()); }