|
23 | 23 |
|
24 | 24 | import org.aopalliance.intercept.MethodInterceptor;
|
25 | 25 | import org.aopalliance.intercept.MethodInvocation;
|
26 |
| -import org.aspectj.weaver.tools.PointcutPrimitive; |
27 |
| -import org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException; |
28 | 26 | import org.junit.jupiter.api.BeforeEach;
|
29 | 27 | import org.junit.jupiter.api.Test;
|
30 | 28 | import test.annotation.EmptySpringAnnotation;
|
|
41 | 39 | import org.springframework.beans.testfixture.beans.subpkg.DeepBean;
|
42 | 40 |
|
43 | 41 | import static org.assertj.core.api.Assertions.assertThat;
|
44 |
| -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
45 | 42 | import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
46 | 43 | import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
47 | 44 |
|
@@ -174,23 +171,23 @@ private void testWithinPackage(boolean matchSubpackages) throws SecurityExceptio
|
174 | 171 | void testFriendlyErrorOnNoLocationClassMatching() {
|
175 | 172 | AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
|
176 | 173 | assertThatIllegalStateException()
|
177 |
| - .isThrownBy(() -> pc.matches(ITestBean.class)) |
| 174 | + .isThrownBy(() -> pc.getClassFilter().matches(ITestBean.class)) |
178 | 175 | .withMessageContaining("expression");
|
179 | 176 | }
|
180 | 177 |
|
181 | 178 | @Test
|
182 | 179 | void testFriendlyErrorOnNoLocation2ArgMatching() {
|
183 | 180 | AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
|
184 | 181 | assertThatIllegalStateException()
|
185 |
| - .isThrownBy(() -> pc.matches(getAge, ITestBean.class)) |
| 182 | + .isThrownBy(() -> pc.getMethodMatcher().matches(getAge, ITestBean.class)) |
186 | 183 | .withMessageContaining("expression");
|
187 | 184 | }
|
188 | 185 |
|
189 | 186 | @Test
|
190 | 187 | void testFriendlyErrorOnNoLocation3ArgMatching() {
|
191 | 188 | AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
|
192 | 189 | assertThatIllegalStateException()
|
193 |
| - .isThrownBy(() -> pc.matches(getAge, ITestBean.class, (Object[]) null)) |
| 190 | + .isThrownBy(() -> pc.getMethodMatcher().matches(getAge, ITestBean.class, (Object[]) null)) |
194 | 191 | .withMessageContaining("expression");
|
195 | 192 | }
|
196 | 193 |
|
@@ -246,7 +243,7 @@ void testDynamicMatchingProxy() {
|
246 | 243 | @Test
|
247 | 244 | void testInvalidExpression() {
|
248 | 245 | String expression = "execution(void org.springframework.beans.testfixture.beans.TestBean.setSomeNumber(Number) && args(Double)";
|
249 |
| - assertThatIllegalArgumentException().isThrownBy(getPointcut(expression)::getClassFilter); // call to getClassFilter forces resolution |
| 246 | + assertThatIllegalArgumentException().isThrownBy(() -> getPointcut(expression).getClassFilter().matches(Object.class)); |
250 | 247 | }
|
251 | 248 |
|
252 | 249 | private TestBean getAdvisedProxy(String pointcutExpression, CallCountingInterceptor interceptor) {
|
@@ -276,9 +273,7 @@ private void assertMatchesTestBeanClass(ClassFilter classFilter) {
|
276 | 273 | @Test
|
277 | 274 | void testWithUnsupportedPointcutPrimitive() {
|
278 | 275 | String expression = "call(int org.springframework.beans.testfixture.beans.TestBean.getAge())";
|
279 |
| - assertThatExceptionOfType(UnsupportedPointcutPrimitiveException.class) |
280 |
| - .isThrownBy(() -> getPointcut(expression).getClassFilter()) // call to getClassFilter forces resolution... |
281 |
| - .satisfies(ex -> assertThat(ex.getUnsupportedPrimitive()).isEqualTo(PointcutPrimitive.CALL)); |
| 276 | + assertThat(getPointcut(expression).getClassFilter().matches(Object.class)).isFalse(); |
282 | 277 | }
|
283 | 278 |
|
284 | 279 | @Test
|
|
0 commit comments