Skip to content

Commit b0c6e5e

Browse files
committed
Polishing
(cherry picked from commit c970c31)
1 parent a7efa96 commit b0c6e5e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java

Lines changed: 8 additions & 6 deletions
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-2020 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.
@@ -36,24 +36,26 @@
3636
public class AtAspectJAfterThrowingTests {
3737

3838
@Test
39-
public void testAccessThrowable() throws Exception {
39+
public void testAccessThrowable() {
4040
ClassPathXmlApplicationContext ctx =
41-
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
41+
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
4242

4343
ITestBean bean = (ITestBean) ctx.getBean("testBean");
4444
ExceptionHandlingAspect aspect = (ExceptionHandlingAspect) ctx.getBean("aspect");
4545

4646
assertThat(AopUtils.isAopProxy(bean)).isTrue();
47+
IOException exceptionThrown = null;
4748
try {
4849
bean.unreliableFileOperation();
4950
}
50-
catch (IOException e) {
51-
//
51+
catch (IOException ex) {
52+
exceptionThrown = ex;
5253
}
5354

5455
assertThat(aspect.handled).isEqualTo(1);
55-
assertThat(aspect.lastException).isNotNull();
56+
assertThat(aspect.lastException).isSameAs(exceptionThrown);
5657
}
58+
5759
}
5860

5961

spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAnnotationBindingTests.java

Lines changed: 3 additions & 3 deletions
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-2020 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.
@@ -36,6 +36,7 @@
3636
public class AtAspectJAnnotationBindingTests {
3737

3838
private AnnotatedTestBean testBean;
39+
3940
private ClassPathXmlApplicationContext ctx;
4041

4142

@@ -70,8 +71,7 @@ public void testPointcutEvaluatedAgainstArray() {
7071
class AtAspectJAnnotationBindingTestAspect {
7172

7273
@Around("execution(* *(..)) && @annotation(testAnn)")
73-
public Object doWithAnnotation(ProceedingJoinPoint pjp, TestAnnotation testAnn)
74-
throws Throwable {
74+
public Object doWithAnnotation(ProceedingJoinPoint pjp, TestAnnotation testAnn) throws Throwable {
7575
String annValue = testAnn.value();
7676
Object result = pjp.proceed();
7777
return (result instanceof String ? annValue + " " + result : result);

0 commit comments

Comments
 (0)