Address TODOs in SpEL's Indexer
This commit deletes outdated TODOs and addresses a remaining "current" TODO in SpEL's Indexer.
This commit is contained in:
@@ -44,6 +44,25 @@ import static org.springframework.expression.spel.SpelMessage.UNABLE_TO_GROW_COL
|
||||
@SuppressWarnings("rawtypes")
|
||||
class IndexingTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void indexIntoArrays() {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
|
||||
// One-dimensional
|
||||
this.property = new int[] {1, 2, 3, 4};
|
||||
Expression expression = parser.parseExpression("property[2]");
|
||||
assertThat(expression.getValue(this)).isEqualTo(3);
|
||||
|
||||
// Multi-dimensional
|
||||
this.property = new int[][] {{1, 2}, {3, 4}};
|
||||
expression = parser.parseExpression("property[0]");
|
||||
assertThat(expression.getValue(this)).isEqualTo(new int[] {1, 2});
|
||||
expression = parser.parseExpression("property[1][1]");
|
||||
assertThat(expression.getValue(this)).isEqualTo(4);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void indexIntoGenericPropertyContainingMap() {
|
||||
|
||||
Reference in New Issue
Block a user