Fix warnings

This commit is contained in:
Rossen Stoyanchev
2018-02-08 17:46:10 -05:00
parent f107fdcdcf
commit da6d1492c1
29 changed files with 111 additions and 132 deletions

View File

@@ -31,7 +31,6 @@ import javax.faces.render.ResponseStateManager;
*
* @since 2.4
*/
@SuppressWarnings("deprecation")
public abstract class ResponseStateManagerWrapper extends ResponseStateManager implements
FacesWrapper<ResponseStateManager> {

View File

@@ -18,7 +18,6 @@ package org.springframework.faces.webflow;
import javax.faces.context.FacesContext;
import org.springframework.webflow.execution.FlowExecutionListener;
import org.springframework.webflow.execution.FlowExecutionListenerAdapter;
import org.springframework.webflow.execution.RequestContext;
/**
@@ -28,7 +27,7 @@ import org.springframework.webflow.execution.RequestContext;
*
* @author Rossen Stoyanchev
*/
public class FlowFacesContextLifecycleListener extends FlowExecutionListenerAdapter {
public class FlowFacesContextLifecycleListener implements FlowExecutionListener {
public static final String DEFAULT_FACES_CONTEXT =
FlowFacesContextLifecycleListener.class.getName() + ".DEFAULT_FACES_CONTEXT";

View File

@@ -49,7 +49,6 @@ import org.springframework.webflow.execution.RequestContextHolder;
* @see FlowResponseStateManager
* @see FlowRenderKit
*/
@SuppressWarnings("deprecation")
public class MyFacesFlowResponseStateManager extends ResponseStateManager
implements FacesWrapper<ResponseStateManager> {

View File

@@ -32,7 +32,7 @@ public class FlowActionListenerTests extends TestCase {
LocalAttributeMap<Object> flash = new LocalAttributeMap<>();
EasyMock.expect(this.context.getFlashScope()).andStubReturn(flash);
EasyMock.expect(this.context.getCurrentState()).andStubReturn(new MockViewState());
EasyMock.replay(new Object[] { this.context });
EasyMock.replay(this.context);
}
protected void tearDown() throws Exception {

View File

@@ -3,7 +3,6 @@ package org.springframework.faces.webflow;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIInput;
@@ -23,10 +22,10 @@ import javax.faces.event.SystemEvent;
import javax.faces.lifecycle.Lifecycle;
import junit.framework.TestCase;
import org.apache.el.ExpressionFactoryImpl;
import org.apache.myfaces.test.mock.MockApplication20;
import org.easymock.EasyMock;
import org.apache.el.ExpressionFactoryImpl;
import org.springframework.binding.expression.ExpressionParser;
import org.springframework.binding.expression.support.FluentParserContext;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -60,8 +59,6 @@ public class JsfViewFactoryTests extends TestCase {
private Lifecycle lifecycle;
private PhaseListener trackingListener;
private final ExpressionParser parser = new WebFlowELExpressionParser(new ExpressionFactoryImpl());
private final MockExternalContext extContext = new MockExternalContext();
@@ -94,8 +91,8 @@ public class JsfViewFactoryTests extends TestCase {
this.jsfMock.setUp();
ExceptionEventAwareMockApplication application = new ExceptionEventAwareMockApplication();
((MockBaseFacesContext) FlowFacesContext.getCurrentInstance()).setApplication(application);
this.trackingListener = new TrackingPhaseListener();
this.jsfMock.lifecycle().addPhaseListener(this.trackingListener);
PhaseListener trackingListener = new TrackingPhaseListener();
this.jsfMock.lifecycle().addPhaseListener(trackingListener);
this.jsfMock.facesContext().setViewRoot(null);
this.jsfMock.facesContext().getApplication().setViewHandler(this.viewHandler);
}
@@ -116,7 +113,7 @@ public class JsfViewFactoryTests extends TestCase {
this.context.inViewState();
EasyMock.expectLastCall().andReturn(true);
EasyMock.replay(new Object[] { this.context });
EasyMock.replay(this.context);
View newView = this.factory.getView(this.context);
@@ -147,7 +144,7 @@ public class JsfViewFactoryTests extends TestCase {
this.context.inViewState();
EasyMock.expectLastCall().andReturn(true);
EasyMock.replay(new Object[] { this.context });
EasyMock.replay(this.context);
View restoredView = this.factory.getView(this.context);
@@ -162,6 +159,7 @@ public class JsfViewFactoryTests extends TestCase {
/**
* View already exists in view/flash scope and must be restored and the lifecycle executed, no flow event signaled
*/
@SuppressWarnings("deprecation")
public final void testGetView_RestoreWithBindings() {
this.lifecycle = new NoExecutionLifecycle(this.jsfMock.lifecycle());
@@ -174,8 +172,7 @@ public class JsfViewFactoryTests extends TestCase {
UIPanel panel = new UIPanel();
panel.setId("panel1");
UIOutput output = new UIOutput();
output.setValueBinding("binding", this.jsfMock.facesContext().getApplication()
.createValueBinding("#{myBean.output}"));
output.setValueBinding("binding", this.jsfMock.facesContext().getApplication().createValueBinding("#{myBean.output}"));
output.setId("output1");
UIInput input = new UIInput();
input.setValueBinding("binding", this.jsfMock.facesContext().getApplication().createValueBinding("#{myBean.input}"));
@@ -186,6 +183,7 @@ public class JsfViewFactoryTests extends TestCase {
panel.getChildren().add(input);
TestBean testBean = new TestBean();
//noinspection unchecked
this.jsfMock.externalContext().getRequestMap().put("myBean", testBean);
((MockViewHandler) this.viewHandler).setRestoreView(existingRoot);
@@ -193,7 +191,7 @@ public class JsfViewFactoryTests extends TestCase {
this.context.inViewState();
EasyMock.expectLastCall().andReturn(true);
EasyMock.replay(new Object[] { this.context });
EasyMock.replay(this.context);
View restoredView = this.factory.getView(this.context);
@@ -228,13 +226,13 @@ public class JsfViewFactoryTests extends TestCase {
this.context.inViewState();
EasyMock.expectLastCall().andReturn(true);
EasyMock.replay(new Object[] { this.context });
EasyMock.replay(this.context);
View restoredView = this.factory.getView(this.context);
assertNotNull("A View was not restored", restoredView);
assertTrue("A JsfView was expected", restoredView instanceof JsfView);
assertTrue("An ViewRoot was not set", ((JsfView) restoredView).getViewRoot() instanceof UIViewRoot);
assertTrue("An ViewRoot was not set", ((JsfView) restoredView).getViewRoot() != null);
assertEquals("View name did not match", VIEW_ID, ((JsfView) restoredView).getViewRoot().getViewId());
assertFalse("An unexpected event was signaled,", restoredView.hasFlowEvent());
assertTrue("The PostRestoreViewEvent was not seen", existingRoot.isPostRestoreStateEventSeen());
@@ -254,7 +252,7 @@ public class JsfViewFactoryTests extends TestCase {
this.jsfMock.facesContext().setViewRoot(newRoot);
this.jsfMock.facesContext().renderResponse();
EasyMock.replay(new Object[] { this.context });
EasyMock.replay(this.context);
View newView = this.factory.getView(this.context);
@@ -266,7 +264,7 @@ public class JsfViewFactoryTests extends TestCase {
assertTrue("The PostRestoreViewEvent was not seen", newRoot.isPostRestoreStateEventSeen());
}
public void testGetView_ExceptionsOnPostRestoreStateEvent() throws Exception {
public void testGetView_ExceptionsOnPostRestoreStateEvent() {
this.lifecycle = new NoExecutionLifecycle(this.jsfMock.lifecycle());
this.factory = new JsfViewFactory(this.parser.parseExpression(VIEW_ID,
new FluentParserContext().template().evaluate(RequestContext.class).expectResult(String.class)),
@@ -280,7 +278,7 @@ public class JsfViewFactoryTests extends TestCase {
this.context.inViewState();
EasyMock.expectLastCall().andReturn(true);
EasyMock.replay(new Object[] { this.context });
EasyMock.replay(this.context);
this.factory.getView(this.context);
ExceptionEventAwareMockApplication application = (ExceptionEventAwareMockApplication) FlowFacesContext
.getCurrentInstance().getApplication();