Add @Override annotations to test sources
Issue: SPR-10129
This commit is contained in:
@@ -173,6 +173,7 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
|
||||
|
||||
static class DummyConstructorResolver implements ConstructorResolver {
|
||||
|
||||
@Override
|
||||
public ConstructorExecutor resolve(EvaluationContext context, String typeName, List<TypeDescriptor> argumentTypes)
|
||||
throws AccessException {
|
||||
throw new UnsupportedOperationException("Auto-generated method stub");
|
||||
|
||||
@@ -608,6 +608,7 @@ public class EvaluationTests extends ExpressionTestCase {
|
||||
|
||||
static class CustomMethodResolver implements MethodResolver {
|
||||
|
||||
@Override
|
||||
public MethodExecutor resolve(EvaluationContext context,
|
||||
Object targetObject, String name,
|
||||
List<TypeDescriptor> argumentTypes) throws AccessException {
|
||||
@@ -617,6 +618,7 @@ public class EvaluationTests extends ExpressionTestCase {
|
||||
|
||||
static class CustomMethodFilter implements MethodFilter {
|
||||
|
||||
@Override
|
||||
public List<Method> filter(List<Method> methods) {
|
||||
return null;
|
||||
}
|
||||
@@ -1373,6 +1375,7 @@ public class EvaluationTests extends ExpressionTestCase {
|
||||
|
||||
static class MyBeanResolver implements BeanResolver {
|
||||
|
||||
@Override
|
||||
public Object resolve(EvaluationContext context, String beanName)
|
||||
throws AccessException {
|
||||
if (beanName.equals("foo") || beanName.equals("bar")) {
|
||||
|
||||
@@ -256,22 +256,27 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase {
|
||||
/**
|
||||
* Null means you might be able to read any property, if an earlier property resolver hasn't beaten you to it
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return propertyMap.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(propertyMap.get(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
}
|
||||
@@ -295,22 +300,27 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase {
|
||||
/**
|
||||
* Null means you might be able to read any property, if an earlier property resolver hasn't beaten you to it
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return propertyMap.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(propertyMap.get(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
|
||||
}
|
||||
|
||||
|
||||
@@ -182,10 +182,12 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
|
||||
|
||||
private final ConversionService service = new DefaultConversionService();
|
||||
|
||||
@Override
|
||||
public boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return this.service.canConvert(sourceType, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) throws EvaluationException {
|
||||
return this.service.convert(value, sourceType, targetType);
|
||||
}
|
||||
|
||||
@@ -62,24 +62,29 @@ public class IndexingTests {
|
||||
|
||||
public static class MapAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return (((Map) target).containsKey(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(((Map) target).get(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
((Map) target).put(name, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class[] { Map.class };
|
||||
}
|
||||
|
||||
@@ -149,24 +149,29 @@ public class MapAccessTests extends ExpressionTestCase {
|
||||
|
||||
public static class MapAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return (((Map) target).containsKey(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(((Map) target).get(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
((Map) target).put(name, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class[] { Map.class };
|
||||
}
|
||||
|
||||
@@ -274,6 +274,7 @@ public class MethodInvocationTests extends ExpressionTestCase {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Method> filter(List<Method> methods) {
|
||||
filterCalled = true;
|
||||
List<Method> forRemoval = new ArrayList<Method>();
|
||||
@@ -329,6 +330,7 @@ public class MethodInvocationTests extends ExpressionTestCase {
|
||||
|
||||
static class DummyMethodResolver implements MethodResolver {
|
||||
|
||||
@Override
|
||||
public MethodExecutor resolve(EvaluationContext context, Object targetObject, String name,
|
||||
List<TypeDescriptor> argumentTypes) throws AccessException {
|
||||
throw new UnsupportedOperationException("Auto-generated method stub");
|
||||
@@ -379,6 +381,7 @@ public class MethodInvocationTests extends ExpressionTestCase {
|
||||
byte[] bytes = new byte[100];
|
||||
StandardEvaluationContext context = new StandardEvaluationContext(bytes);
|
||||
context.setBeanResolver(new BeanResolver() {
|
||||
@Override
|
||||
public Object resolve(EvaluationContext context, String beanName)
|
||||
throws AccessException {
|
||||
if ("service".equals(beanName)) {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class OperatorOverloaderTests extends ExpressionTestCase {
|
||||
|
||||
static class StringAndBooleanAddition implements OperatorOverloader {
|
||||
|
||||
@Override
|
||||
public Object operate(Operation operation, Object leftOperand, Object rightOperand) throws EvaluationException {
|
||||
if (operation==Operation.ADD) {
|
||||
return ((String)leftOperand)+((Boolean)rightOperand).toString();
|
||||
@@ -42,6 +43,7 @@ public class OperatorOverloaderTests extends ExpressionTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean overridesOperation(Operation operation, Object leftOperand, Object rightOperand)
|
||||
throws EvaluationException {
|
||||
if (leftOperand instanceof String && rightOperand instanceof Boolean) {
|
||||
|
||||
@@ -170,28 +170,33 @@ public class PropertyAccessTests extends ExpressionTestCase {
|
||||
|
||||
int flibbles = 7;
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class[] { String.class };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
if (!(target instanceof String))
|
||||
throw new RuntimeException("Assertion Failed! target should be String");
|
||||
return (name.equals("flibbles"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
if (!(target instanceof String))
|
||||
throw new RuntimeException("Assertion Failed! target should be String");
|
||||
return (name.equals("flibbles"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
if (!name.equals("flibbles"))
|
||||
throw new RuntimeException("Assertion Failed! name should be flibbles");
|
||||
return new TypedValue(flibbles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
if (!name.equals("flibbles"))
|
||||
|
||||
@@ -187,6 +187,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
super(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRoles() { return new String[]{"MANAGER"};}
|
||||
}
|
||||
|
||||
@@ -197,6 +198,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
super(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRoles() { return new String[]{"TELLER"};}
|
||||
}
|
||||
|
||||
@@ -207,6 +209,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
super(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRoles() { return new String[]{"SUPERVISOR"};}
|
||||
}
|
||||
|
||||
@@ -217,22 +220,27 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
public String name = "Andy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return name.equals("principal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(new Principal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return null;
|
||||
}
|
||||
@@ -247,22 +255,27 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
|
||||
void setPerson(Person p) { this.activePerson = p; }
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return name.equals("p");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(activePerson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return null;
|
||||
}
|
||||
@@ -280,6 +293,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
this.tc = typeConverter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue execute(EvaluationContext context, Object target, Object... arguments)
|
||||
throws AccessException {
|
||||
try {
|
||||
@@ -303,6 +317,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodExecutor resolve(EvaluationContext context, Object targetObject, String name, List<TypeDescriptor> arguments)
|
||||
throws AccessException {
|
||||
if (name.equals("hasRole")) {
|
||||
|
||||
@@ -487,14 +487,17 @@ public class SpelDocumentationTests extends ExpressionTestCase {
|
||||
|
||||
static class TemplatedParserContext implements ParserContext {
|
||||
|
||||
@Override
|
||||
public String getExpressionPrefix() {
|
||||
return "${";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExpressionSuffix() {
|
||||
return "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTemplate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
|
||||
static class MyTypeLocator extends StandardTypeLocator {
|
||||
|
||||
@Override
|
||||
public Class<?> findType(String typename) throws EvaluationException {
|
||||
if (typename.equals("Spr5899Class")) {
|
||||
return Spr5899Class.class;
|
||||
@@ -240,23 +241,28 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
|
||||
static class MapAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return (((Map<?,?>) target).containsKey(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(((Map<?,?>) target).get(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
|
||||
((Map<String, Object>) target).put(name, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class[] {Map.class};
|
||||
}
|
||||
@@ -546,12 +552,15 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
}
|
||||
|
||||
private static final ParserContext DOLLARSQUARE_TEMPLATE_PARSER_CONTEXT = new ParserContext() {
|
||||
@Override
|
||||
public String getExpressionPrefix() {
|
||||
return "$[";
|
||||
}
|
||||
@Override
|
||||
public String getExpressionSuffix() {
|
||||
return "]";
|
||||
}
|
||||
@Override
|
||||
public boolean isTemplate() {
|
||||
return true;
|
||||
}
|
||||
@@ -626,6 +635,7 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
}
|
||||
|
||||
static class MyBeanResolver implements BeanResolver {
|
||||
@Override
|
||||
public Object resolve(EvaluationContext context, String beanname) throws AccessException {
|
||||
if (beanname.equals("foo")) {
|
||||
return "custard";
|
||||
@@ -1100,21 +1110,26 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name)
|
||||
throws AccessException {
|
||||
return getMap(target).containsKey(name);
|
||||
}
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name)
|
||||
throws AccessException {
|
||||
return getMap(target).containsKey(name);
|
||||
}
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class[]{ContextObject.class};
|
||||
}
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name)
|
||||
throws AccessException {
|
||||
return new TypedValue(getMap(target).get(name));
|
||||
}
|
||||
@Override
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
getMap(target).put(name, (String) newValue);
|
||||
@@ -1701,6 +1716,7 @@ public class SpelReproTests extends ExpressionTestCase {
|
||||
|
||||
private static class GenericImplementation implements GenericInterface<Integer> {
|
||||
|
||||
@Override
|
||||
public Integer getProperty() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -36,24 +36,30 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
public class TemplateExpressionParsingTests extends ExpressionTestCase {
|
||||
|
||||
public static final ParserContext DEFAULT_TEMPLATE_PARSER_CONTEXT = new ParserContext() {
|
||||
@Override
|
||||
public String getExpressionPrefix() {
|
||||
return "${";
|
||||
}
|
||||
@Override
|
||||
public String getExpressionSuffix() {
|
||||
return "}";
|
||||
}
|
||||
@Override
|
||||
public boolean isTemplate() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public static final ParserContext HASH_DELIMITED_PARSER_CONTEXT = new ParserContext() {
|
||||
@Override
|
||||
public String getExpressionPrefix() {
|
||||
return "#{";
|
||||
}
|
||||
@Override
|
||||
public String getExpressionSuffix() {
|
||||
return "}";
|
||||
}
|
||||
@Override
|
||||
public boolean isTemplate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ public class OpPlusTests {
|
||||
|
||||
GenericConversionService conversionService = new GenericConversionService();
|
||||
conversionService.addConverter(new Converter<Time, String>() {
|
||||
@Override
|
||||
public String convert(Time source) {
|
||||
return format.format(source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user