Polish SpEL's Indexer and test

This commit is contained in:
Sam Brannen
2024-02-21 17:44:09 +01:00
parent 5a2b127a21
commit 734fc476ee
2 changed files with 29 additions and 12 deletions

View File

@@ -62,7 +62,6 @@ class IndexingTests {
assertThat(expression.getValue(this)).isEqualTo(4);
}
@Test
@SuppressWarnings("unchecked")
void indexIntoGenericPropertyContainingMap() {
@@ -302,7 +301,7 @@ class IndexingTests {
@Test
void indexIntoGenericPropertyContainingArray() {
String[] property = new String[] { "bar" };
String[] property = { "bar" };
this.property = property;
SpelExpressionParser parser = new SpelExpressionParser();
Expression expression = parser.parseExpression("property");
@@ -357,17 +356,17 @@ class IndexingTests {
@Test
@SuppressWarnings("unchecked")
void testListOfScalar() {
void listOfScalars() {
listOfScalarNotGeneric = new ArrayList(1);
listOfScalarNotGeneric.add("5");
SpelExpressionParser parser = new SpelExpressionParser();
Expression expression = parser.parseExpression("listOfScalarNotGeneric[0]");
assertThat(expression.getValue(this, Integer.class)).isEqualTo(Integer.valueOf(5));
assertThat(expression.getValue(this, Integer.class)).isEqualTo(5);
}
@Test
@SuppressWarnings("unchecked")
void testListsOfMap() {
void listOfMaps() {
listOfMapsNotGeneric = new ArrayList();
Map map = new HashMap();
map.put("fruit", "apple");