Polishing
This commit is contained in:
		
							parent
							
								
									a39867bd8e
								
							
						
					
					
						commit
						8c4436926f
					
				| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2013 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2015 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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2014-2015 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2015 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.
 | 
			
		||||
| 
						 | 
				
			
			@ -1172,7 +1172,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		assertFalse((Boolean)expression.getValue());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void opGt() throws Exception {
 | 
			
		||||
		expression = parse("3.0d > 4.0d");
 | 
			
		||||
| 
						 | 
				
			
			@ -1319,7 +1318,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		assertCanCompile(expression);
 | 
			
		||||
		assertTrue((Boolean)expression.getValue(tc7));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		expression = parse("3.0d == 4.0d");
 | 
			
		||||
		assertCanCompile(expression);
 | 
			
		||||
		assertFalse((Boolean)expression.getValue());
 | 
			
		||||
| 
						 | 
				
			
			@ -1671,43 +1669,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		assertEquals(3L,expression.getValue());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public class PayloadX {
 | 
			
		||||
		public int valueI = 120;
 | 
			
		||||
		public Integer valueIB = 120;
 | 
			
		||||
		public Integer valueIB58 = 58;
 | 
			
		||||
		public Integer valueIB60 = 60;
 | 
			
		||||
		public long valueJ = 120L;
 | 
			
		||||
		public Long valueJB = 120L;
 | 
			
		||||
		public Long valueJB58 = 58L;
 | 
			
		||||
		public Long valueJB60 = 60L;
 | 
			
		||||
		public double valueD = 120D;
 | 
			
		||||
		public Double valueDB = 120D;
 | 
			
		||||
		public Double valueDB58 = 58D;
 | 
			
		||||
		public Double valueDB60 = 60D;
 | 
			
		||||
		public float valueF = 120F;
 | 
			
		||||
		public Float valueFB = 120F;
 | 
			
		||||
		public Float valueFB58 = 58F;
 | 
			
		||||
		public Float valueFB60 = 60F;
 | 
			
		||||
		public byte valueB = (byte)120;
 | 
			
		||||
		public byte valueB18 = (byte)18;
 | 
			
		||||
		public byte valueB20 = (byte)20;
 | 
			
		||||
		public Byte valueBB = (byte)120;
 | 
			
		||||
		public Byte valueBB18 = (byte)18;
 | 
			
		||||
		public Byte valueBB20 = (byte)20;
 | 
			
		||||
		public char valueC = (char)120;
 | 
			
		||||
		public Character valueCB = (char)120;
 | 
			
		||||
		public short valueS = (short)120;
 | 
			
		||||
		public short valueS18 = (short)18;
 | 
			
		||||
		public short valueS20 = (short)20;
 | 
			
		||||
		public Short valueSB = (short)120;
 | 
			
		||||
		public Short valueSB18 = (short)18;
 | 
			
		||||
		public Short valueSB20 = (short)20;
 | 
			
		||||
		public PayloadX payload;
 | 
			
		||||
		public PayloadX() {
 | 
			
		||||
			payload = this;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void opDivide_mixedNumberTypes() throws Exception {
 | 
			
		||||
		PayloadX p = new PayloadX();
 | 
			
		||||
| 
						 | 
				
			
			@ -2156,16 +2117,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		assertEquals("objectobject",expression.getValue(new Greeter()));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static class Greeter {
 | 
			
		||||
		public String getWorld() {
 | 
			
		||||
			return "world";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public Object getObject() {
 | 
			
		||||
			return "object";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void opMinus() throws Exception {
 | 
			
		||||
		expression = parse("2-2");
 | 
			
		||||
| 
						 | 
				
			
			@ -2994,8 +2945,8 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void failsWhenSettingContextForExpression_SPR12326() {
 | 
			
		||||
	    SpelExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE, this
 | 
			
		||||
	            .getClass().getClassLoader()));
 | 
			
		||||
		SpelExpressionParser parser = new SpelExpressionParser(
 | 
			
		||||
				new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE, getClass().getClassLoader()));
 | 
			
		||||
		Person3 person = new Person3("foo", 1);
 | 
			
		||||
		SpelExpression expression = parser.parseRaw("#it?.age?.equals([0])");
 | 
			
		||||
		StandardEvaluationContext context = new StandardEvaluationContext(new Object[] { 1 });
 | 
			
		||||
| 
						 | 
				
			
			@ -3112,40 +3063,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		assertTrue((Boolean)ex.getValue(context));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public class Person {
 | 
			
		||||
 | 
			
		||||
	    private int age;
 | 
			
		||||
 | 
			
		||||
	    public Person(int age) {
 | 
			
		||||
	        this.age = age;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    public int getAge() {
 | 
			
		||||
	        return age;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    public void setAge(int age) {
 | 
			
		||||
	        this.age = age;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public class Person3 {
 | 
			
		||||
 | 
			
		||||
	    private int age;
 | 
			
		||||
 | 
			
		||||
	    public Person3(String name, int age) {
 | 
			
		||||
	        this.age = age;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    public int getAge() {
 | 
			
		||||
	        return age;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    public void setAge(int age) {
 | 
			
		||||
	        this.age = age;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void constructorReference() throws Exception {
 | 
			
		||||
		// simple ctor
 | 
			
		||||
| 
						 | 
				
			
			@ -3668,7 +3585,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		assertCantCompile(expression); // method takes a string and we are passing an Integer
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void errorHandling() throws Exception {
 | 
			
		||||
		TestClass5 tc = new TestClass5();
 | 
			
		||||
| 
						 | 
				
			
			@ -3835,7 +3751,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		assertEquals("D",getAst().getExitDescriptor());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	public void mixingItUp_indexerOpEqTernary() throws Exception {
 | 
			
		||||
		Map<String, String> m = new HashMap<String,String>();
 | 
			
		||||
| 
						 | 
				
			
			@ -4558,7 +4473,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
 | 
			
		||||
	// helper classes
 | 
			
		||||
 | 
			
		||||
	public static interface Message<T> {
 | 
			
		||||
	public interface Message<T> {
 | 
			
		||||
 | 
			
		||||
		MessageHeaders getHeaders();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -4763,6 +4678,17 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
 | 
			
		||||
	// test classes
 | 
			
		||||
 | 
			
		||||
	public static class Greeter {
 | 
			
		||||
 | 
			
		||||
		public String getWorld() {
 | 
			
		||||
			return "world";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public Object getObject() {
 | 
			
		||||
			return "object";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static class FooObject {
 | 
			
		||||
 | 
			
		||||
		public Object getObject() { return "hello"; }
 | 
			
		||||
| 
						 | 
				
			
			@ -4805,6 +4731,40 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		public Payload2 payload2 = new Payload2();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public class Person {
 | 
			
		||||
 | 
			
		||||
		private int age;
 | 
			
		||||
 | 
			
		||||
		public Person(int age) {
 | 
			
		||||
			this.age = age;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public int getAge() {
 | 
			
		||||
			return age;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void setAge(int age) {
 | 
			
		||||
			this.age = age;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public class Person3 {
 | 
			
		||||
 | 
			
		||||
		private int age;
 | 
			
		||||
 | 
			
		||||
		public Person3(String name, int age) {
 | 
			
		||||
			this.age = age;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public int getAge() {
 | 
			
		||||
			return age;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void setAge(int age) {
 | 
			
		||||
			this.age = age;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static class Two {
 | 
			
		||||
 | 
			
		||||
		Three three = new Three();
 | 
			
		||||
| 
						 | 
				
			
			@ -4826,6 +4786,44 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public class PayloadX {
 | 
			
		||||
 | 
			
		||||
		public int valueI = 120;
 | 
			
		||||
		public Integer valueIB = 120;
 | 
			
		||||
		public Integer valueIB58 = 58;
 | 
			
		||||
		public Integer valueIB60 = 60;
 | 
			
		||||
		public long valueJ = 120L;
 | 
			
		||||
		public Long valueJB = 120L;
 | 
			
		||||
		public Long valueJB58 = 58L;
 | 
			
		||||
		public Long valueJB60 = 60L;
 | 
			
		||||
		public double valueD = 120D;
 | 
			
		||||
		public Double valueDB = 120D;
 | 
			
		||||
		public Double valueDB58 = 58D;
 | 
			
		||||
		public Double valueDB60 = 60D;
 | 
			
		||||
		public float valueF = 120F;
 | 
			
		||||
		public Float valueFB = 120F;
 | 
			
		||||
		public Float valueFB58 = 58F;
 | 
			
		||||
		public Float valueFB60 = 60F;
 | 
			
		||||
		public byte valueB = (byte)120;
 | 
			
		||||
		public byte valueB18 = (byte)18;
 | 
			
		||||
		public byte valueB20 = (byte)20;
 | 
			
		||||
		public Byte valueBB = (byte)120;
 | 
			
		||||
		public Byte valueBB18 = (byte)18;
 | 
			
		||||
		public Byte valueBB20 = (byte)20;
 | 
			
		||||
		public char valueC = (char)120;
 | 
			
		||||
		public Character valueCB = (char)120;
 | 
			
		||||
		public short valueS = (short)120;
 | 
			
		||||
		public short valueS18 = (short)18;
 | 
			
		||||
		public short valueS20 = (short)20;
 | 
			
		||||
		public Short valueSB = (short)120;
 | 
			
		||||
		public Short valueSB18 = (short)18;
 | 
			
		||||
		public Short valueSB20 = (short)20;
 | 
			
		||||
		public PayloadX payload;
 | 
			
		||||
		public PayloadX() {
 | 
			
		||||
			payload = this;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static class TestClass1 {
 | 
			
		||||
 | 
			
		||||
		public int index1 = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -5094,7 +5092,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
 | 
			
		|||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static class TestClass6 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -314,7 +314,7 @@ public abstract class AbstractMethodMessageHandler<T>
 | 
			
		|||
	 * under the same mapping
 | 
			
		||||
	 */
 | 
			
		||||
	protected void registerHandlerMethod(Object handler, Method method, T mapping) {
 | 
			
		||||
		Assert.notNull(mapping, "Mapping must bot be null");
 | 
			
		||||
		Assert.notNull(mapping, "Mapping must not be null");
 | 
			
		||||
		HandlerMethod newHandlerMethod = createHandlerMethod(handler, method);
 | 
			
		||||
		HandlerMethod oldHandlerMethod = this.handlerMethods.get(mapping);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue