From 4ec8ae42f48da6415a3be29507c9e327dec94538 Mon Sep 17 00:00:00 2001 From: Kenzo Spaulding Date: Wed, 26 May 2021 22:33:51 -0700 Subject: [PATCH] Add test cases to SpEL's MapAccessorTests Closes gh-26981 --- .../context/expression/MapAccessorTests.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spring-context/src/test/java/org/springframework/context/expression/MapAccessorTests.java b/spring-context/src/test/java/org/springframework/context/expression/MapAccessorTests.java index df73adaa36..8fd4d2fb9a 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/MapAccessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/MapAccessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -67,6 +67,17 @@ public class MapAccessorTests { assertThat(ex.getValue(sec,mapGetter)).isEqualTo("bar"); assertThat(SpelCompiler.compile(ex)).isTrue(); assertThat(ex.getValue(sec,mapGetter)).isEqualTo("bar"); + + // basic isWritable + ex = sep.parseExpression("foo"); + assertThat(ex.isWritable(sec,testMap)).isTrue(); + + // basic write + ex = sep.parseExpression("foo2"); + ex.setValue(sec, testMap, "bar2"); + assertThat(ex.getValue(sec,testMap)).isEqualTo("bar2"); + assertThat(SpelCompiler.compile(ex)).isTrue(); + assertThat(ex.getValue(sec,testMap)).isEqualTo("bar2"); } public static class MapGetter {