Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
snicoll committed Jan 3, 2024
1 parent f846d94 commit 05ebca8
Showing 218 changed files with 1,576 additions and 1,591 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -64,7 +64,7 @@ void setup() throws Exception {
}

@AfterEach
void tearDown() throws Exception {
void tearDown() {
this.ctx.close();
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -62,22 +62,22 @@ void tearDown() {


@Test
void simpleAfterThrowing() throws Throwable {
void simpleAfterThrowing() {
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(new Throwable()));
verify(mockCollaborator).noArgs();
}

@Test
void afterThrowingWithBinding() throws Throwable {
void afterThrowingWithBinding() {
Throwable t = new Throwable();
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(t));
verify(mockCollaborator).oneThrowable(t);
}

@Test
void afterThrowingWithNamedTypeRestriction() throws Throwable {
void afterThrowingWithNamedTypeRestriction() {
Throwable t = new Throwable();
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(t));
@@ -87,22 +87,22 @@ void afterThrowingWithNamedTypeRestriction() throws Throwable {
}

@Test
void afterThrowingWithRuntimeExceptionBinding() throws Throwable {
void afterThrowingWithRuntimeExceptionBinding() {
RuntimeException ex = new RuntimeException();
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(ex));
verify(mockCollaborator).oneRuntimeException(ex);
}

@Test
void afterThrowingWithTypeSpecified() throws Throwable {
void afterThrowingWithTypeSpecified() {
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(new Throwable()));
verify(mockCollaborator).noArgsOnThrowableMatch();
}

@Test
void afterThrowingWithRuntimeTypeSpecified() throws Throwable {
void afterThrowingWithRuntimeTypeSpecified() {
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(new RuntimeException()));
verify(mockCollaborator).noArgsOnRuntimeExceptionMatch();
@@ -123,7 +123,7 @@ public interface AfterThrowingAdviceBindingCollaborator {
void noArgsOnRuntimeExceptionMatch();
}

protected AfterThrowingAdviceBindingCollaborator collaborator = null;
AfterThrowingAdviceBindingCollaborator collaborator = null;

public void setCollaborator(AfterThrowingAdviceBindingCollaborator aCollaborator) {
this.collaborator = aCollaborator;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@@ -242,8 +242,7 @@ class SimpleSpringBeforeAdvice implements MethodBeforeAdvice, BeanNameAware {
* @see org.springframework.aop.MethodBeforeAdvice#before(java.lang.reflect.Method, java.lang.Object[], java.lang.Object)
*/
@Override
public void before(Method method, Object[] args, @Nullable Object target)
throws Throwable {
public void before(Method method, Object[] args, @Nullable Object target) {
this.collaborator.beforeAdviceOne(this.name);
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -139,7 +139,7 @@ public static class TestInterceptor implements MethodBeforeAdvice {
private int interceptionCount;

@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
public void before(Method method, Object[] args, @Nullable Object target) {
interceptionCount++;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@@ -119,7 +119,7 @@ void atAnnotationMethodAnnotationMatch() {
}

interface TestInterface {
public void doIt();
void doIt();
}

static class TestImpl implements TestInterface {
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@@ -107,7 +107,7 @@ void thisAsInterfaceAndTargetAsClassCounterMatch() {


interface TestInterface {
public void doIt();
void doIt();
}


Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2024 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.
@@ -23,7 +23,7 @@
*/
class AnnotationBindingTestAspect {

public String doWithAnnotation(ProceedingJoinPoint pjp, TestAnnotation testAnnotation) throws Throwable {
public String doWithAnnotation(ProceedingJoinPoint pjp, TestAnnotation testAnnotation) {
return testAnnotation.value();
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@@ -65,7 +65,7 @@ void noMatchingWithoutAnnotationPresent() {
class TestMethodInterceptor implements MethodInterceptor {

@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
public Object invoke(MethodInvocation methodInvocation) {
return "this value";
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@@ -51,7 +51,7 @@ void proxyCreation() {


interface AnInterface {
public void interfaceMethod();
void interfaceMethod();
}


Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -226,7 +226,7 @@ class TraceAfterReturningAdvice implements AfterReturningAdvice {
public int afterTakesInt;

@Override
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) {
++afterTakesInt;
}

@@ -270,7 +270,7 @@ class TraceBeforeAdvice implements MethodBeforeAdvice {
public int beforeStringReturn;

@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
public void before(Method method, Object[] args, Object target) {
++beforeStringReturn;
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -59,7 +59,7 @@ void serviceIsAdvised() {
class TransactionInterceptor {

@Around(value="execution(* *..Service.*(..)) && @annotation(transaction)")
public Object around(ProceedingJoinPoint pjp, Transaction transaction) throws Throwable {
public Object around(ProceedingJoinPoint pjp, Transaction transaction) {
throw new RuntimeException("advice invoked");
//return pjp.proceed();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -157,11 +157,11 @@ class CountingAspectJAdvice {

private int aroundCount;

public void myBeforeAdvice() throws Throwable {
public void myBeforeAdvice() {
this.beforeCount++;
}

public void myAfterAdvice() throws Throwable {
public void myAfterAdvice() {
this.afterCount++;
}

Loading

0 comments on commit 05ebca8

Please sign in to comment.