Skip to content

Commit 4ec8ae4

Browse files
kzs0sbrannen
authored andcommitted
Add test cases to SpEL's MapAccessorTests
Closes gh-26981
1 parent 995aaa6 commit 4ec8ae4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

spring-context/src/test/java/org/springframework/context/expression/MapAccessorTests.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -67,6 +67,17 @@ public void mapAccessorCompilable() {
6767
assertThat(ex.getValue(sec,mapGetter)).isEqualTo("bar");
6868
assertThat(SpelCompiler.compile(ex)).isTrue();
6969
assertThat(ex.getValue(sec,mapGetter)).isEqualTo("bar");
70+
71+
// basic isWritable
72+
ex = sep.parseExpression("foo");
73+
assertThat(ex.isWritable(sec,testMap)).isTrue();
74+
75+
// basic write
76+
ex = sep.parseExpression("foo2");
77+
ex.setValue(sec, testMap, "bar2");
78+
assertThat(ex.getValue(sec,testMap)).isEqualTo("bar2");
79+
assertThat(SpelCompiler.compile(ex)).isTrue();
80+
assertThat(ex.getValue(sec,testMap)).isEqualTo("bar2");
7081
}
7182

7283
public static class MapGetter {

0 commit comments

Comments
 (0)