Fix SpEL withRootObject test

The test case is intended to be for the method 'withRootObject()', but
actually it's copied from the previous test method that does not use
'withRootObject()'.

This commit fixes the propertyReadWriteWithRootObject() test method in
PropertyAccessTests.

Closes gh-27905
This commit is contained in:
justlikeliuen
2022-01-08 10:45:16 +08:00
committed by Sam Brannen
parent 709a41fd43
commit 3e75ec73ab

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@@ -232,17 +232,17 @@ public class PropertyAccessTests extends AbstractExpressionTests {
assertThat(context.getRootObject().getValue()).isSameAs(target);
Expression expr = parser.parseExpression("name");
assertThat(expr.getValue(context, target)).isEqualTo("p1");
assertThat(expr.getValue(context)).isEqualTo("p1");
target.setName("p2");
assertThat(expr.getValue(context, target)).isEqualTo("p2");
assertThat(expr.getValue(context)).isEqualTo("p2");
parser.parseExpression("name='p3'").getValue(context, target);
assertThat(target.getName()).isEqualTo("p3");
assertThat(expr.getValue(context, target)).isEqualTo("p3");
assertThat(expr.getValue(context)).isEqualTo("p3");
expr.setValue(context, target, "p4");
expr.setValue(context, "p4");
assertThat(target.getName()).isEqualTo("p4");
assertThat(expr.getValue(context, target)).isEqualTo("p4");
assertThat(expr.getValue(context)).isEqualTo("p4");
}
@Test