Polishing

This commit is contained in:
Sam Brannen
2024-03-05 11:58:19 +01:00
parent 1ea593e777
commit b44c31e997

View File

@@ -175,7 +175,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
Map<String, Integer> map = Map.of("a", 13, "b", 42);
// Prerequisite: root type must not be public for this use case.
assertThat(Modifier.isPublic(map.getClass().getModifiers())).isFalse();
assertNotPublic(map.getClass());
expression = parser.parseExpression(spel);
Integer result = expression.getValue(map, Integer.class);
@@ -549,7 +549,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
Map<String, int[]> map = Map.of("foo", new int[] { 1, 2, 3 });
// Prerequisite: root type must not be public for this use case.
assertThat(Modifier.isPublic(map.getClass().getModifiers())).isFalse();
assertNotPublic(map.getClass());
// map key access
expression = parser.parseExpression("['foo']");
@@ -590,7 +590,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
Map<String, int[]> map = Map.of("foo", new int[] { 1, 2, 3 });
// Prerequisite: root type must not be public for this use case.
assertThat(Modifier.isPublic(map.getClass().getModifiers())).isFalse();
assertNotPublic(map.getClass());
// map key access
expression = parser.parseExpression("['foo']");
@@ -5477,6 +5477,10 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
return parser.parseExpression(expression);
}
private static void assertNotPublic(Class<?> clazz) {
assertThat(Modifier.isPublic(clazz.getModifiers())).as("%s must be private", clazz.getName()).isFalse();
}
// Nested types