org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver Java Examples

The following examples show how to use org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpelReproTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void reservedWordProperties_SPR9862() {
	StandardEvaluationContext context = new StandardEvaluationContext();
	SpelExpressionParser parser = new SpelExpressionParser();
	SpelExpression expression = parser.parseRaw("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST");
	Object value = expression.getValue(context);
	assertEquals(value, Reserver.CONST);
}
 
Example #2
Source File: SpelReproTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void reservedWordProperties_SPR9862() {
	StandardEvaluationContext context = new StandardEvaluationContext();
	SpelExpressionParser parser = new SpelExpressionParser();
	SpelExpression expression = parser.parseRaw("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST");
	Object value = expression.getValue(context);
	assertEquals(value, Reserver.CONST);
}
 
Example #3
Source File: SpelReproTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void reservedWordProperties_9862() throws Exception {
	StandardEvaluationContext ctx = new StandardEvaluationContext();
	SpelExpressionParser parser = new SpelExpressionParser();
	SpelExpression expression = parser.parseRaw("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST");
	Object value = expression.getValue(ctx);
	assertEquals(value, Reserver.CONST);
}
 
Example #4
Source File: SpelReproTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void reservedWords_SPR8228() {

	// "DIV","EQ","GE","GT","LE","LT","MOD","NE","NOT"
	@SuppressWarnings("unused")
	class Reserver {
		public Reserver getReserver() {
			return this;
		}
		public String NE = "abc";
		public String ne = "def";

		public int DIV = 1;
		public int div = 3;

		public Map<String, String> m = new HashMap<>();

		Reserver() {
			m.put("NE", "xyz");
		}
	}

	StandardEvaluationContext context = new StandardEvaluationContext(new Reserver());
	SpelExpressionParser parser = new SpelExpressionParser();
	String ex = "getReserver().NE";
	SpelExpression exp = parser.parseRaw(ex);
	String value = (String) exp.getValue(context);
	assertEquals("abc", value);

	ex = "getReserver().ne";
	exp = parser.parseRaw(ex);
	value = (String) exp.getValue(context);
	assertEquals("def", value);

	ex = "getReserver().m[NE]";
	exp = parser.parseRaw(ex);
	value = (String) exp.getValue(context);
	assertEquals("xyz", value);

	ex = "getReserver().DIV";
	exp = parser.parseRaw(ex);
	assertEquals(1, exp.getValue(context));

	ex = "getReserver().div";
	exp = parser.parseRaw(ex);
	assertEquals(3, exp.getValue(context));

	exp = parser.parseRaw("NE");
	assertEquals("abc", exp.getValue(context));
}
 
Example #5
Source File: SpelReproTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void reservedWords_SPR8228() {

	// "DIV","EQ","GE","GT","LE","LT","MOD","NE","NOT"
	@SuppressWarnings("unused")
	class Reserver {
		public Reserver getReserver() {
			return this;
		}
		public String NE = "abc";
		public String ne = "def";

		public int DIV = 1;
		public int div = 3;

		public Map<String, String> m = new HashMap<>();

		Reserver() {
			m.put("NE", "xyz");
		}
	}

	StandardEvaluationContext context = new StandardEvaluationContext(new Reserver());
	SpelExpressionParser parser = new SpelExpressionParser();
	String ex = "getReserver().NE";
	SpelExpression exp = parser.parseRaw(ex);
	String value = (String) exp.getValue(context);
	assertEquals("abc", value);

	ex = "getReserver().ne";
	exp = parser.parseRaw(ex);
	value = (String) exp.getValue(context);
	assertEquals("def", value);

	ex = "getReserver().m[NE]";
	exp = parser.parseRaw(ex);
	value = (String) exp.getValue(context);
	assertEquals("xyz", value);

	ex = "getReserver().DIV";
	exp = parser.parseRaw(ex);
	assertEquals(1, exp.getValue(context));

	ex = "getReserver().div";
	exp = parser.parseRaw(ex);
	assertEquals(3, exp.getValue(context));

	exp = parser.parseRaw("NE");
	assertEquals("abc", exp.getValue(context));
}
 
Example #6
Source File: SpelReproTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void reservedWords_8228() throws Exception {
	// "DIV","EQ","GE","GT","LE","LT","MOD","NE","NOT"
	@SuppressWarnings("unused")
	class Reserver {
		public Reserver getReserver() {
			return this;
		}
		public String NE = "abc";
		public String ne = "def";

		public int DIV = 1;
		public int div = 3;

		public Map<String, String> m = new HashMap<String, String>();

		Reserver() {
			m.put("NE", "xyz");
		}
	}

	StandardEvaluationContext ctx = new StandardEvaluationContext(new Reserver());
	SpelExpressionParser parser = new SpelExpressionParser();
	String ex = "getReserver().NE";
	SpelExpression exp = parser.parseRaw(ex);
	String value = (String) exp.getValue(ctx);
	assertEquals("abc", value);

	ex = "getReserver().ne";
	exp = parser.parseRaw(ex);
	value = (String) exp.getValue(ctx);
	assertEquals("def", value);

	ex = "getReserver().m[NE]";
	exp = parser.parseRaw(ex);
	value = (String) exp.getValue(ctx);
	assertEquals("xyz", value);

	ex = "getReserver().DIV";
	exp = parser.parseRaw(ex);
	assertEquals(1, exp.getValue(ctx));

	ex = "getReserver().div";
	exp = parser.parseRaw(ex);
	assertEquals(3, exp.getValue(ctx));

	exp = parser.parseRaw("NE");
	assertEquals("abc", exp.getValue(ctx));
}