Polish
Remove: - auto-boxing - unnecessary array creation - public keyword on interface methods - unnecessary throws clauses Use lambda expressions
This commit is contained in:
@@ -30,34 +30,34 @@ public interface SelectionAware<T> {
|
||||
* Checks whether the row pointed to by the model's current index is selected.
|
||||
* @return true if the current row data object is selected
|
||||
*/
|
||||
public boolean isCurrentRowSelected();
|
||||
boolean isCurrentRowSelected();
|
||||
|
||||
/**
|
||||
* Sets whether the row pointed to by the model's current index is selected
|
||||
* @param rowSelected true to select the current row
|
||||
*/
|
||||
public void setCurrentRowSelected(boolean rowSelected);
|
||||
void setCurrentRowSelected(boolean rowSelected);
|
||||
|
||||
/**
|
||||
* Sets the list of selected row data objects for the model.
|
||||
* @param selections the list of selected row data objects
|
||||
*/
|
||||
public void setSelections(List<T> selections);
|
||||
void setSelections(List<T> selections);
|
||||
|
||||
/**
|
||||
* Returns the list of selected row data objects for the model.
|
||||
* @return the list of selected row data objects
|
||||
*/
|
||||
public List<T> getSelections();
|
||||
List<T> getSelections();
|
||||
|
||||
/**
|
||||
* Selects all row data objects in the model.
|
||||
*/
|
||||
public void selectAll();
|
||||
void selectAll();
|
||||
|
||||
/**
|
||||
* Selects the given row data object in the model.
|
||||
* @param rowData the row data object to select.
|
||||
*/
|
||||
public void select(T rowData);
|
||||
void select(T rowData);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DataModelConverter implements Converter {
|
||||
if (targetClass.equals(DataModel.class)) {
|
||||
targetClass = OneSelectionTrackingListDataModel.class;
|
||||
}
|
||||
Constructor<?> emptyConstructor = ClassUtils.getConstructorIfAvailable(targetClass, new Class[] {});
|
||||
Constructor<?> emptyConstructor = ClassUtils.getConstructorIfAvailable(targetClass);
|
||||
DataModel<?> model = (DataModel<?>) emptyConstructor.newInstance(new Object[] {});
|
||||
model.setWrappedData(source);
|
||||
return model;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
/*
|
||||
* Copyright 2004-2008 the original author or authimport org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.convert.support.DefaultConversionService;
|
||||
import org.springframework.faces.model.OneSelectionTrackingListDataModel;
|
||||
e.org/licenses/LICENSE-2.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,
|
||||
|
||||
@@ -81,7 +81,7 @@ public class FaceletsAuthorizeTagHandler extends TagHandler {
|
||||
}
|
||||
|
||||
if (this.var != null) {
|
||||
faceletContext.setAttribute(this.var.getValue(faceletContext), Boolean.valueOf(isAuthorized));
|
||||
faceletContext.setAttribute(this.var.getValue(faceletContext), isAuthorized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class JsfAjaxHandler extends AbstractAjaxHandler {
|
||||
} else {
|
||||
String header = request.getHeader("Faces-Request");
|
||||
String param = request.getParameter("javax.faces.partial.ajax");
|
||||
return ("partial/ajax".equals(header) || "true".equals(param)) ? true : false;
|
||||
return "partial/ajax".equals(header) || "true".equals(param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,19 +56,19 @@ public class JsfManagedBeanPropertyAccessor implements PropertyAccessor {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) {
|
||||
return (getJsfManagedBean(name) != null);
|
||||
}
|
||||
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) {
|
||||
return new TypedValue(getJsfManagedBean(name));
|
||||
}
|
||||
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) {
|
||||
return (getScopeForBean(name) != null);
|
||||
}
|
||||
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue) {
|
||||
MutableAttributeMap<Object> map = getScopeForBean(name);
|
||||
if (map != null) {
|
||||
map.put(name, newValue);
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
package org.springframework.faces.webflow;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.faces.application.ResourceHandler;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -38,7 +36,7 @@ import org.springframework.web.context.support.WebApplicationObjectSupport;
|
||||
public class JsfResourceRequestHandler extends WebApplicationObjectSupport implements HttpRequestHandler {
|
||||
|
||||
public void handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
throws IOException {
|
||||
|
||||
FacesContextHelper helper = new FacesContextHelper();
|
||||
try {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class JsfUtils {
|
||||
private static final Map<Class<?>, String> FACTORY_NAMES;
|
||||
|
||||
static {
|
||||
FACTORY_NAMES = new HashMap<Class<?>, String>();
|
||||
FACTORY_NAMES = new HashMap<>();
|
||||
FACTORY_NAMES.put(ApplicationFactory.class, FactoryFinder.APPLICATION_FACTORY);
|
||||
FACTORY_NAMES.put(ExceptionHandlerFactory.class, FactoryFinder.EXCEPTION_HANDLER_FACTORY);
|
||||
FACTORY_NAMES.put(ExternalContextFactory.class, FactoryFinder.EXTERNAL_CONTEXT_FACTORY);
|
||||
|
||||
@@ -16,8 +16,6 @@ import org.springframework.faces.webflow.FacesSpringELExpressionParser;
|
||||
import org.springframework.faces.webflow.JSFMockHelper;
|
||||
import org.springframework.faces.webflow.JsfViewFactoryCreator;
|
||||
import org.springframework.validation.Validator;
|
||||
import org.springframework.faces.config.EmptySpringValidator;
|
||||
import org.springframework.faces.config.MyBeanValidationHintResolver;
|
||||
import org.springframework.webflow.engine.builder.BinderConfiguration;
|
||||
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
|
||||
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
|
||||
|
||||
@@ -94,11 +94,11 @@ public class SelectionTrackingActionListenerTests extends TestCase {
|
||||
uiRepeat.getChildren().add(commandButton);
|
||||
this.viewToTest.getChildren().add(uiRepeat);
|
||||
|
||||
Method indexMutator = ReflectionUtils.findMethod(UIRepeat.class, "setIndex", new Class[] { FacesContext.class,
|
||||
int.class });
|
||||
Method indexMutator = ReflectionUtils.findMethod(UIRepeat.class, "setIndex", FacesContext.class,
|
||||
int.class);
|
||||
indexMutator.setAccessible(true);
|
||||
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), 1 });
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new MockFacesContext(), 1);
|
||||
|
||||
ActionEvent event = new ActionEvent(commandButton);
|
||||
|
||||
@@ -108,7 +108,7 @@ public class SelectionTrackingActionListenerTests extends TestCase {
|
||||
assertSame(this.dataModel.getSelectedRow(), this.dataModel.getRowData());
|
||||
assertTrue(this.delegateListener.processedEvent);
|
||||
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new Object[] { new MockFacesContext(), 2 });
|
||||
ReflectionUtils.invokeMethod(indexMutator, uiRepeat, new MockFacesContext(), 2);
|
||||
assertFalse(this.dataModel.isCurrentRowSelected());
|
||||
assertTrue(this.dataModel.getSelectedRow() != this.dataModel.getRowData());
|
||||
}
|
||||
|
||||
@@ -23,43 +23,43 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class FaceletsAuthorizeTagTests extends TestCase {
|
||||
|
||||
public void testIfAllGrantedWithOneRole() throws Exception {
|
||||
public void testIfAllGrantedWithOneRole() {
|
||||
FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag();
|
||||
tag.setIfAllGranted("ROLE_A");
|
||||
assertEquals("hasRole('ROLE_A')", tag.getAccess());
|
||||
}
|
||||
|
||||
public void testIfAllGrantedWithMultipleRoles() throws Exception {
|
||||
public void testIfAllGrantedWithMultipleRoles() {
|
||||
FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag();
|
||||
tag.setIfAllGranted("ROLE_A, ROLE_B, ROLE_C");
|
||||
assertEquals("hasRole('ROLE_A') and hasRole('ROLE_B') and hasRole('ROLE_C')", tag.getAccess());
|
||||
}
|
||||
|
||||
public void testIfAnyGrantedWithOneRole() throws Exception {
|
||||
public void testIfAnyGrantedWithOneRole() {
|
||||
FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag();
|
||||
tag.setIfAnyGranted("ROLE_A");
|
||||
assertEquals("hasAnyRole('ROLE_A')", tag.getAccess());
|
||||
}
|
||||
|
||||
public void testIfAnyGrantedWithMultipleRole() throws Exception {
|
||||
public void testIfAnyGrantedWithMultipleRole() {
|
||||
FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag();
|
||||
tag.setIfAnyGranted("ROLE_A, ROLE_B, ROLE_C");
|
||||
assertEquals("hasAnyRole('ROLE_A','ROLE_B','ROLE_C')", tag.getAccess());
|
||||
}
|
||||
|
||||
public void testIfNoneGrantedWithOneRole() throws Exception {
|
||||
public void testIfNoneGrantedWithOneRole() {
|
||||
FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag();
|
||||
tag.setIfNotGranted("ROLE_A");
|
||||
assertEquals("!hasAnyRole('ROLE_A')", tag.getAccess());
|
||||
}
|
||||
|
||||
public void testIfNoneGrantedWithMultipleRole() throws Exception {
|
||||
public void testIfNoneGrantedWithMultipleRole() {
|
||||
FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag();
|
||||
tag.setIfNotGranted("ROLE_A, ROLE_B, ROLE_C");
|
||||
assertEquals("!hasAnyRole('ROLE_A','ROLE_B','ROLE_C')", tag.getAccess());
|
||||
}
|
||||
|
||||
public void testIfAllAnyNotGranted() throws Exception {
|
||||
public void testIfAllAnyNotGranted() {
|
||||
FaceletsAuthorizeTag tag = new FaceletsAuthorizeTag();
|
||||
tag.setIfAllGranted("ROLE_A");
|
||||
tag.setIfAnyGranted("ROLE_B");
|
||||
|
||||
@@ -8,15 +8,13 @@ import javax.faces.el.MethodNotFoundException;
|
||||
import javax.faces.event.ActionEvent;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.easymock.EasyMock;
|
||||
|
||||
import org.springframework.webflow.core.collection.LocalAttributeMap;
|
||||
import org.springframework.webflow.engine.Flow;
|
||||
import org.springframework.webflow.engine.ViewState;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.RequestContextHolder;
|
||||
import org.springframework.webflow.execution.View;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
|
||||
public class FlowActionListenerTests extends TestCase {
|
||||
|
||||
@@ -85,7 +83,7 @@ public class FlowActionListenerTests extends TestCase {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
public Object invoke(FacesContext context, Object... args) throws EvaluationException, MethodNotFoundException {
|
||||
public Object invoke(FacesContext context, Object... args) throws EvaluationException {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@@ -94,11 +92,8 @@ public class FlowActionListenerTests extends TestCase {
|
||||
private class MockViewState extends ViewState {
|
||||
|
||||
public MockViewState() {
|
||||
super(new Flow("mockFlow"), "mockView", new ViewFactory() {
|
||||
|
||||
public View getView(RequestContext context) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
super(new Flow("mockFlow"), "mockView", context -> {
|
||||
throw new UnsupportedOperationException();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package org.springframework.faces.webflow;
|
||||
import javax.el.ELContext;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.myfaces.test.el.MockELContext;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
import org.springframework.webflow.core.collection.LocalAttributeMap;
|
||||
@@ -26,29 +26,29 @@ public class FlowELResolverTests extends TestCase {
|
||||
|
||||
private final ELContext elContext = new MockELContext();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
protected void setUp() {
|
||||
RequestContextHolder.setRequestContext(this.requestContext);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
protected void tearDown() {
|
||||
RequestContextHolder.setRequestContext(null);
|
||||
}
|
||||
|
||||
public void testRequestContextResolve() throws Exception {
|
||||
public void testRequestContextResolve() {
|
||||
Object actual = this.resolver.getValue(this.elContext, null, "flowRequestContext");
|
||||
assertTrue(this.elContext.isPropertyResolved());
|
||||
assertNotNull(actual);
|
||||
assertSame(this.requestContext, actual);
|
||||
}
|
||||
|
||||
public void testImplicitFlowResolve() throws Exception {
|
||||
public void testImplicitFlowResolve() {
|
||||
Object actual = this.resolver.getValue(this.elContext, null, "flowScope");
|
||||
assertTrue(this.elContext.isPropertyResolved());
|
||||
assertNotNull(actual);
|
||||
assertSame(this.requestContext.getFlowScope(), actual);
|
||||
}
|
||||
|
||||
public void testFlowResourceResolve() throws Exception {
|
||||
public void testFlowResourceResolve() {
|
||||
ApplicationContext applicationContext = new StaticWebApplicationContext();
|
||||
((Flow) this.requestContext.getActiveFlow()).setApplicationContext(applicationContext);
|
||||
Object actual = this.resolver.getValue(this.elContext, null, "resourceBundle");
|
||||
@@ -57,14 +57,14 @@ public class FlowELResolverTests extends TestCase {
|
||||
assertSame(applicationContext, actual);
|
||||
}
|
||||
|
||||
public void testScopeResolve() throws Exception {
|
||||
public void testScopeResolve() {
|
||||
this.requestContext.getFlowScope().put("test", "test");
|
||||
Object actual = this.resolver.getValue(this.elContext, null, "test");
|
||||
assertTrue(this.elContext.isPropertyResolved());
|
||||
assertEquals("test", actual);
|
||||
}
|
||||
|
||||
public void testMapAdaptableResolve() throws Exception {
|
||||
public void testMapAdaptableResolve() {
|
||||
LocalAttributeMap<String> base = new LocalAttributeMap<>();
|
||||
base.put("test", "test");
|
||||
Object actual = this.resolver.getValue(this.elContext, base, "test");
|
||||
@@ -72,7 +72,7 @@ public class FlowELResolverTests extends TestCase {
|
||||
assertEquals("test", actual);
|
||||
}
|
||||
|
||||
public void testBeanResolveWithRequestContext() throws Exception {
|
||||
public void testBeanResolveWithRequestContext() {
|
||||
StaticWebApplicationContext applicationContext = new StaticWebApplicationContext();
|
||||
((Flow) this.requestContext.getActiveFlow()).setApplicationContext(applicationContext);
|
||||
applicationContext.registerSingleton("test", Bean.class);
|
||||
@@ -82,7 +82,7 @@ public class FlowELResolverTests extends TestCase {
|
||||
assertTrue(actual instanceof Bean);
|
||||
}
|
||||
|
||||
public void testBeanResolveWithoutRequestContext() throws Exception {
|
||||
public void testBeanResolveWithoutRequestContext() {
|
||||
RequestContextHolder.setRequestContext(null);
|
||||
Object actual = this.resolver.getValue(this.elContext, null, "test");
|
||||
assertFalse(this.elContext.isPropertyResolved());
|
||||
|
||||
@@ -54,7 +54,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testAddMessage() {
|
||||
this.messageContext = new DefaultMessageContext();
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar"));
|
||||
|
||||
@@ -66,7 +66,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testGetGlobalMessagesOnly() {
|
||||
this.messageContext = new DefaultMessageContext();
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar"));
|
||||
this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "FOO", "BAR"));
|
||||
@@ -84,7 +84,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testGetAllMessages() {
|
||||
this.messageContext = new DefaultMessageContext();
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar"));
|
||||
this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "FOO", "BAR"));
|
||||
@@ -102,7 +102,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testAddMessages_MultipleNullIds() {
|
||||
this.messageContext = new DefaultMessageContext();
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "foo", "bar"));
|
||||
this.facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "zoo", "zar"));
|
||||
@@ -116,7 +116,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testGetMessages() {
|
||||
this.messageContext = this.prepopulatedMessageContext;
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
int iterationCount = 0;
|
||||
Iterator<FacesMessage> i = this.facesContext.getMessages();
|
||||
@@ -130,7 +130,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testMutableGetMessages() {
|
||||
this.messageContext = this.prepopulatedMessageContext;
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
this.facesContext.addMessage("TESTID", new FacesMessage("summary1"));
|
||||
FacesMessage soruceMessage = this.facesContext.getMessages("TESTID").next();
|
||||
@@ -148,7 +148,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testGetMessagesByClientId_ForComponent() {
|
||||
this.messageContext = this.prepopulatedMessageContext;
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
int iterationCount = 0;
|
||||
Iterator<FacesMessage> i = this.facesContext.getMessages("componentId");
|
||||
@@ -165,7 +165,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testGetMessagesByClientId_ForUserMessage() {
|
||||
this.messageContext = this.prepopulatedMessageContext;
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
int iterationCount = 0;
|
||||
Iterator<FacesMessage> i = this.facesContext.getMessages("userMessage");
|
||||
@@ -182,7 +182,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testgetMessagesByClientId_InvalidId() {
|
||||
this.messageContext = this.prepopulatedMessageContext;
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
Iterator<FacesMessage> i = this.facesContext.getMessages("unknown");
|
||||
assertFalse(i.hasNext());
|
||||
@@ -191,7 +191,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testGetClientIdsWithMessages() {
|
||||
this.messageContext = this.prepopulatedMessageContext;
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
List<String> expectedOrderedIds = new ArrayList<>();
|
||||
expectedOrderedIds.add(null);
|
||||
@@ -211,7 +211,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testMessagesAreSerializable() throws Exception {
|
||||
DefaultMessageContext messageContext = new DefaultMessageContext();
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
this.facesContext.addMessage("TESTID", new FacesMessage("summary1"));
|
||||
FacesMessage sourceMessage = this.facesContext.getMessages("TESTID").next();
|
||||
@@ -232,9 +232,9 @@ public class FlowFacesContextTests extends TestCase {
|
||||
ois.close();
|
||||
|
||||
messageContext.restoreMessages(mementoRead);
|
||||
EasyMock.reset(new Object[] { this.requestContext });
|
||||
EasyMock.reset(this.requestContext);
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
FacesContext newFacesContext = new FlowFacesContext(this.requestContext, this.jsf.facesContext());
|
||||
assertSame(FacesContext.getCurrentInstance(), newFacesContext);
|
||||
@@ -246,7 +246,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testGetMaximumSeverity() {
|
||||
this.messageContext = this.prepopulatedMessageContext;
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
assertEquals(FacesMessage.SEVERITY_FATAL, this.facesContext.getMaximumSeverity());
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public class FlowFacesContextTests extends TestCase {
|
||||
public final void testValidationFailed() {
|
||||
this.messageContext = new DefaultMessageContext();
|
||||
EasyMock.expect(this.requestContext.getMessageContext()).andStubReturn(this.messageContext);
|
||||
EasyMock.replay(new Object[] { this.requestContext });
|
||||
EasyMock.replay(this.requestContext);
|
||||
|
||||
this.facesContext.addMessage("foo", new FacesMessage(FacesMessage.SEVERITY_ERROR, "foo", "bar"));
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class FlowPartialViewContextTests extends TestCase {
|
||||
RequestContextHolder.setRequestContext(null);
|
||||
}
|
||||
|
||||
public void testReturnFragmentIds() throws Exception {
|
||||
public void testReturnFragmentIds() {
|
||||
String[] fragmentIds = new String[] { "foo", "bar" };
|
||||
|
||||
RequestContext requestContext = new MockRequestContext();
|
||||
@@ -31,7 +31,7 @@ public class FlowPartialViewContextTests extends TestCase {
|
||||
assertEquals(Arrays.asList(fragmentIds), new FlowPartialViewContext(null).getRenderIds());
|
||||
}
|
||||
|
||||
public void testNoFragmentIds() throws Exception {
|
||||
public void testNoFragmentIds() {
|
||||
final List<String> renderIds = Arrays.asList("foo", "bar");
|
||||
FlowPartialViewContext context = new FlowPartialViewContext(new PartialViewContextWrapper() {
|
||||
public Collection<String> getRenderIds() {
|
||||
@@ -51,7 +51,7 @@ public class FlowPartialViewContextTests extends TestCase {
|
||||
assertEquals(renderIds, context.getRenderIds());
|
||||
}
|
||||
|
||||
public void testReturnFragmentIdsMutable() throws Exception {
|
||||
public void testReturnFragmentIdsMutable() {
|
||||
String[] fragmentIds = new String[] { "foo", "bar" };
|
||||
|
||||
RequestContext requestContext = new MockRequestContext();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.springframework.faces.webflow;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.easymock.EasyMock;
|
||||
@@ -37,11 +39,11 @@ public class FlowResponseStateManagerTests extends TestCase {
|
||||
RequestContextHolder.setRequestContext(null);
|
||||
}
|
||||
|
||||
public void testname() throws Exception {
|
||||
public void testname() {
|
||||
|
||||
}
|
||||
|
||||
public void testWriteFlowSerializedView() throws Exception {
|
||||
public void testWriteFlowSerializedView() throws IOException {
|
||||
EasyMock.expect(this.flowExecutionContext.getKey()).andReturn(new MockFlowExecutionKey("e1s1"));
|
||||
LocalAttributeMap<Object> viewMap = new LocalAttributeMap<>();
|
||||
EasyMock.expect(this.requestContext.getViewScope()).andStubReturn(viewMap);
|
||||
@@ -58,7 +60,7 @@ public class FlowResponseStateManagerTests extends TestCase {
|
||||
EasyMock.verify(this.flowExecutionContext, this.requestContext);
|
||||
}
|
||||
|
||||
public void testGetState() throws Exception {
|
||||
public void testGetState() {
|
||||
Object state = new Object();
|
||||
|
||||
LocalAttributeMap<Object> viewMap = new LocalAttributeMap<>();
|
||||
|
||||
@@ -41,18 +41,18 @@ public class JsfManagedBeanPropertyAccessorTests extends TestCase {
|
||||
RequestContextHolder.setRequestContext(null);
|
||||
}
|
||||
|
||||
public void testCanRead() throws Exception {
|
||||
public void testCanRead() {
|
||||
this.jsfMock.externalContext().getRequestMap().put("myJsfBean", new Object());
|
||||
assertTrue(this.accessor.canRead(null, null, "myJsfBean"));
|
||||
}
|
||||
|
||||
public void testRead() throws Exception {
|
||||
public void testRead() {
|
||||
Object jsfBean = new Object();
|
||||
this.jsfMock.externalContext().getRequestMap().put("myJsfBean", jsfBean);
|
||||
assertEquals(jsfBean, this.accessor.read(null, null, "myJsfBean").getValue());
|
||||
}
|
||||
|
||||
public void testCanWrite() throws Exception {
|
||||
public void testCanWrite() {
|
||||
assertFalse(this.accessor.canWrite(null, null, "myJsfBean"));
|
||||
|
||||
MutableAttributeMap<Object> map = this.requestContext.getExternalContext().getRequestMap();
|
||||
@@ -71,7 +71,7 @@ public class JsfManagedBeanPropertyAccessorTests extends TestCase {
|
||||
map.clear();
|
||||
}
|
||||
|
||||
public void testWrite() throws Exception {
|
||||
public void testWrite() {
|
||||
Object jsfBean1 = new Object();
|
||||
Object jsfBean2 = new Object();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testBeforeListenersCalledInForwardOrder() throws Exception {
|
||||
public void testBeforeListenersCalledInForwardOrder() {
|
||||
List<OrderVerifyingPhaseListener> list = new ArrayList<>();
|
||||
MockLifecycle lifecycle = new MockLifecycle();
|
||||
PhaseListener listener1 = new OrderVerifyingPhaseListener(null, list);
|
||||
@@ -41,7 +41,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase {
|
||||
assertEquals(listener3, list.get(2));
|
||||
}
|
||||
|
||||
public void testAfterListenersCalledInReverseOrder() throws Exception {
|
||||
public void testAfterListenersCalledInReverseOrder() {
|
||||
List<OrderVerifyingPhaseListener> list = new ArrayList<>();
|
||||
MockLifecycle lifecycle = new MockLifecycle();
|
||||
PhaseListener listener1 = new OrderVerifyingPhaseListener(list, null);
|
||||
@@ -56,7 +56,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase {
|
||||
assertEquals(listener1, list.get(2));
|
||||
}
|
||||
|
||||
public void testGetFactory() throws Exception {
|
||||
public void testGetFactory() {
|
||||
// Not testing all but at least test the mocked factories
|
||||
assertTrue(JsfUtils.findFactory(ApplicationFactory.class) instanceof MockApplicationFactory);
|
||||
assertTrue(JsfUtils.findFactory(FacesContextFactory.class) instanceof MockFacesContextFactory);
|
||||
@@ -64,7 +64,7 @@ public class JsfUtilsTests extends AbstractJsfTestCase {
|
||||
assertTrue(JsfUtils.findFactory(RenderKitFactory.class) instanceof MockRenderKitFactory);
|
||||
}
|
||||
|
||||
public void testGetUnknowFactory() throws Exception {
|
||||
public void testGetUnknowFactory() {
|
||||
try {
|
||||
JsfUtils.findFactory(InputStream.class);
|
||||
fail("Did not throw");
|
||||
|
||||
@@ -380,7 +380,7 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
|
||||
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
|
||||
if (event instanceof PostRestoreStateEvent) {
|
||||
assertSame("Component did not match", this, ((PostRestoreStateEvent) event).getComponent());
|
||||
assertSame("Component did not match", this, event.getComponent());
|
||||
this.postRestoreStateEventSeen = true;
|
||||
if (this.throwOnPostRestoreStateEvent) {
|
||||
this.abortProcessingException = new AbortProcessingException();
|
||||
|
||||
@@ -99,7 +99,7 @@ public class JsfViewTests extends TestCase {
|
||||
}
|
||||
|
||||
public final void testSaveState() {
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope);
|
||||
this.view.saveState();
|
||||
}
|
||||
|
||||
@@ -108,17 +108,17 @@ public class JsfViewTests extends TestCase {
|
||||
EasyMock.expect(this.flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope);
|
||||
|
||||
this.view.render();
|
||||
}
|
||||
|
||||
public final void testRenderException() throws IOException {
|
||||
public final void testRenderException() {
|
||||
|
||||
EasyMock.expect(this.flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope);
|
||||
|
||||
this.jsfMock.application().setViewHandler(new ExceptionalViewHandler());
|
||||
|
||||
@@ -143,7 +143,7 @@ public class JsfViewTests extends TestCase {
|
||||
UIViewRoot existingRoot = new UIViewRoot();
|
||||
existingRoot.setViewId(VIEW_ID);
|
||||
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope);
|
||||
|
||||
JsfView restoredView = new JsfView(existingRoot, lifecycle, this.context);
|
||||
|
||||
@@ -168,7 +168,7 @@ public class JsfViewTests extends TestCase {
|
||||
UIViewRoot existingRoot = new UIViewRoot();
|
||||
existingRoot.setViewId(VIEW_ID);
|
||||
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope);
|
||||
|
||||
JsfView restoredView = new JsfView(existingRoot, lifecycle, this.context);
|
||||
|
||||
@@ -185,7 +185,7 @@ public class JsfViewTests extends TestCase {
|
||||
requestParameterMap.put("execution", "e1s1");
|
||||
|
||||
EasyMock.expect(this.context.getRequestParameters()).andStubReturn(requestParameterMap);
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope);
|
||||
|
||||
JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context);
|
||||
|
||||
@@ -197,7 +197,7 @@ public class JsfViewTests extends TestCase {
|
||||
this.jsfMock.request().addParameter("execution", "e1s1");
|
||||
this.jsfMock.request().addParameter("javax.faces.ViewState", "e1s1");
|
||||
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
EasyMock.replay(this.context, this.flowExecutionContext, this.flowMap, this.flashScope);
|
||||
|
||||
JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context);
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MockJsfExternalContext extends ExternalContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
public URL getResource(String arg0) throws MalformedURLException {
|
||||
public URL getResource(String arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@ package org.springframework.faces.webflow;
|
||||
|
||||
public interface MockService {
|
||||
|
||||
public void doSomething(String arg);
|
||||
void doSomething(String arg);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,6 @@ public class MockViewHandler extends ViewHandler {
|
||||
return this.restoreViewRoot;
|
||||
}
|
||||
|
||||
public void writeState(FacesContext context) throws IOException {
|
||||
public void writeState(FacesContext context) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user