diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java index 3a2e03b7..9aa9aebd 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/FlowActionListenerTests.java @@ -1,10 +1,9 @@ package org.springframework.faces.webflow; +import javax.el.ELContext; +import javax.el.MethodExpression; +import javax.el.MethodInfo; import javax.faces.component.UICommand; -import javax.faces.context.FacesContext; -import javax.faces.el.EvaluationException; -import javax.faces.el.MethodBinding; -import javax.faces.el.MethodNotFoundException; import javax.faces.event.ActionEvent; import junit.framework.TestCase; @@ -44,9 +43,9 @@ public class FlowActionListenerTests extends TestCase { public final void testProcessAction() { String outcome = "foo"; - MethodBinding binding = new MethodBindingStub(outcome); + MethodExpression expression = new MethodExpressionStub(outcome); UICommand commandButton = new UICommand(); - commandButton.setAction(binding); + commandButton.setActionExpression(expression); ActionEvent event = new ActionEvent(commandButton); this.listener.processAction(event); @@ -60,9 +59,9 @@ public class FlowActionListenerTests extends TestCase { public final void testProcessAction_NullOutcome() { String outcome = null; - MethodBinding binding = new MethodBindingStub(outcome); + MethodExpression expression = new MethodExpressionStub(outcome); UICommand commandButton = new UICommand(); - commandButton.setAction(binding); + commandButton.setActionExpression(expression); ActionEvent event = new ActionEvent(commandButton); this.listener.processAction(event); @@ -71,22 +70,43 @@ public class FlowActionListenerTests extends TestCase { this.jsfMock.externalContext().getRequestMap().containsKey(JsfView.EVENT_KEY)); } - private class MethodBindingStub extends MethodBinding { + private class MethodExpressionStub extends MethodExpression { String result; - public MethodBindingStub(String result) { + public MethodExpressionStub(String result) { this.result = result; } - public Class getType(FacesContext context) throws MethodNotFoundException { - return String.class; + @Override + public MethodInfo getMethodInfo(ELContext context) { + return null; } - public Object invoke(FacesContext context, Object[] args) throws EvaluationException { + @Override + public Object invoke(ELContext context, Object[] params) { return this.result; } + @Override + public String getExpressionString() { + return null; + } + + @Override + public boolean equals(Object obj) { + return false; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public boolean isLiteralText() { + return false; + } } private class MockViewState extends ViewState { diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java index 331239db..a40691cd 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java @@ -2,7 +2,6 @@ package org.springframework.faces.webflow; import java.io.IOException; import java.io.StringWriter; - import javax.faces.FacesException; import javax.faces.component.UIForm; import javax.faces.component.UIInput; @@ -13,10 +12,9 @@ import javax.faces.context.FacesContext; import javax.faces.lifecycle.Lifecycle; import junit.framework.TestCase; - import org.apache.myfaces.test.mock.MockResponseWriter; -import org.apache.myfaces.test.mock.MockStateManager; import org.easymock.EasyMock; + import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.execution.FlowExecutionContext; import org.springframework.webflow.execution.FlowExecutionKey; @@ -65,7 +63,6 @@ public class JsfViewTests extends TestCase { this.jsfMock.setUp(); this.jsfMock.facesContext().getApplication().setViewHandler(new MockViewHandler()); - this.jsfMock.facesContext().getApplication().setStateManager(new TestStateManager()); this.jsfMock.facesContext().setResponseWriter(new MockResponseWriter(this.output, null, null)); UIViewRoot viewToRender = new UIViewRoot(); @@ -210,13 +207,6 @@ public class JsfViewTests extends TestCase { } } - private class TestStateManager extends MockStateManager { - public SerializedView saveSerializedView(FacesContext context) { - SerializedView state = new SerializedView(new Object[] { "tree_state" }, new Object[] { "component_state" }); - return state; - } - } - private class NoEventLifecycle extends FlowLifecycle { boolean executed = false; diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/MockApplication.java b/spring-faces/src/test/java/org/springframework/faces/webflow/MockApplication.java deleted file mode 100644 index 73c3f35c..00000000 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/MockApplication.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2004-2012 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.faces.webflow; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Locale; - -import javax.faces.FacesException; -import javax.faces.application.Application; -import javax.faces.application.NavigationHandler; -import javax.faces.application.StateManager; -import javax.faces.application.ViewHandler; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.el.MethodBinding; -import javax.faces.el.PropertyResolver; -import javax.faces.el.ReferenceSyntaxException; -import javax.faces.el.ValueBinding; -import javax.faces.el.VariableResolver; -import javax.faces.event.ActionListener; -import javax.faces.validator.Validator; - -public class MockApplication extends Application { - private ViewHandler viewHandler; - - public ActionListener getActionListener() { - return null; - } - - public void setActionListener(ActionListener listener) { - } - - public Locale getDefaultLocale() { - return null; - } - - public void setDefaultLocale(Locale locale) { - } - - public String getDefaultRenderKitId() { - return null; - } - - public void setDefaultRenderKitId(String renderKitId) { - } - - public String getMessageBundle() { - return null; - } - - public void setMessageBundle(String bundle) { - } - - public NavigationHandler getNavigationHandler() { - return null; - } - - public void setNavigationHandler(NavigationHandler handler) { - } - - public PropertyResolver getPropertyResolver() { - return null; - } - - public void setPropertyResolver(PropertyResolver resolver) { - } - - public VariableResolver getVariableResolver() { - return null; - } - - public void setVariableResolver(VariableResolver resolver) { - } - - public ViewHandler getViewHandler() { - return this.viewHandler; - } - - public void setViewHandler(ViewHandler handler) { - this.viewHandler = handler; - } - - public StateManager getStateManager() { - return null; - } - - public void setStateManager(StateManager manager) { - } - - public void addComponent(String componentType, String componentClass) { - } - - public UIComponent createComponent(String componentType) throws FacesException { - return null; - } - - public UIComponent createComponent(ValueBinding componentBinding, FacesContext context, String componentType) - throws FacesException { - return null; - } - - public Iterator getComponentTypes() { - return null; - } - - public void addConverter(String converterId, String converterClass) { - } - - public void addConverter(Class targetClass, String converterClass) { - } - - public Converter createConverter(String converterId) { - return null; - } - - public Converter createConverter(Class targetClass) { - return null; - } - - public Iterator getConverterIds() { - return null; - } - - public Iterator> getConverterTypes() { - return null; - } - - public MethodBinding createMethodBinding(String ref, Class[] params) throws ReferenceSyntaxException { - return null; - } - - public Iterator getSupportedLocales() { - return null; - } - - public void setSupportedLocales(Collection locales) { - } - - public void addValidator(String validatorId, String validatorClass) { - } - - public Validator createValidator(String validatorId) throws FacesException { - return null; - } - - public Iterator getValidatorIds() { - return null; - } - - public ValueBinding createValueBinding(String ref) throws ReferenceSyntaxException { - return null; - } -}