Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
* @author Juergen Hoeller
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class AnnotationTransactionInterceptorTests {
|
||||
class AnnotationTransactionInterceptorTests {
|
||||
|
||||
private final CallCountingTransactionManager ptm = new CallCountingTransactionManager();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void classLevelOnly() {
|
||||
void classLevelOnly() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestClassLevelOnly());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -74,7 +74,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleMethodOverride() {
|
||||
void withSingleMethodOverride() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithSingleMethodOverride());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -95,7 +95,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleMethodOverrideInverted() {
|
||||
void withSingleMethodOverrideInverted() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithSingleMethodOverrideInverted());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -116,7 +116,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMultiMethodOverride() {
|
||||
void withMultiMethodOverride() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithMultiMethodOverride());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -137,7 +137,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withRollbackOnRuntimeException() {
|
||||
void withRollbackOnRuntimeException() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithExceptions());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -154,7 +154,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCommitOnCheckedException() {
|
||||
void withCommitOnCheckedException() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithExceptions());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -167,7 +167,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withRollbackOnCheckedExceptionAndRollbackRule() {
|
||||
void withRollbackOnCheckedExceptionAndRollbackRule() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithExceptions());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -180,7 +180,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMonoSuccess() {
|
||||
void withMonoSuccess() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithReactive());
|
||||
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
|
||||
@@ -192,7 +192,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMonoFailure() {
|
||||
void withMonoFailure() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithReactive());
|
||||
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
|
||||
@@ -204,7 +204,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMonoRollback() {
|
||||
void withMonoRollback() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithReactive());
|
||||
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
|
||||
@@ -216,7 +216,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withFluxSuccess() {
|
||||
void withFluxSuccess() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithReactive());
|
||||
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
|
||||
@@ -228,7 +228,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withFluxFailure() {
|
||||
void withFluxFailure() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithReactive());
|
||||
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
|
||||
@@ -240,7 +240,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withFluxRollback() {
|
||||
void withFluxRollback() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithReactive());
|
||||
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
|
||||
@@ -252,7 +252,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withVavrTrySuccess() {
|
||||
void withVavrTrySuccess() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithVavrTry());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -264,7 +264,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withVavrTryRuntimeException() {
|
||||
void withVavrTryRuntimeException() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithVavrTry());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -276,7 +276,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withVavrTryCheckedException() {
|
||||
void withVavrTryCheckedException() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithVavrTry());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -288,7 +288,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withVavrTryCheckedExceptionAndRollbackRule() {
|
||||
void withVavrTryCheckedExceptionAndRollbackRule() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithVavrTry());
|
||||
proxyFactory.addAdvice(this.ti);
|
||||
@@ -300,7 +300,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInterface() {
|
||||
void withInterface() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new TestWithInterfaceImpl());
|
||||
proxyFactory.addInterface(TestWithInterface.class);
|
||||
@@ -325,7 +325,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void crossClassInterfaceMethodLevelOnJdkProxy() {
|
||||
void crossClassInterfaceMethodLevelOnJdkProxy() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new SomeServiceImpl());
|
||||
proxyFactory.addInterface(SomeService.class);
|
||||
@@ -344,7 +344,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void crossClassInterfaceOnJdkProxy() {
|
||||
void crossClassInterfaceOnJdkProxy() {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTarget(new OtherServiceImpl());
|
||||
proxyFactory.addInterface(OtherService.class);
|
||||
@@ -357,7 +357,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInterfaceOnTargetJdkProxy() {
|
||||
void withInterfaceOnTargetJdkProxy() {
|
||||
ProxyFactory targetFactory = new ProxyFactory();
|
||||
targetFactory.setTarget(new TestWithInterfaceImpl());
|
||||
targetFactory.addInterface(TestWithInterface.class);
|
||||
@@ -386,7 +386,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInterfaceOnTargetCglibProxy() {
|
||||
void withInterfaceOnTargetCglibProxy() {
|
||||
ProxyFactory targetFactory = new ProxyFactory();
|
||||
targetFactory.setTarget(new TestWithInterfaceImpl());
|
||||
targetFactory.setProxyTargetClass(true);
|
||||
@@ -436,7 +436,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
|
||||
|
||||
@Transactional
|
||||
public static class TestClassLevelOnly {
|
||||
static class TestClassLevelOnly {
|
||||
|
||||
public void doSomething() {
|
||||
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
|
||||
@@ -451,7 +451,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
|
||||
|
||||
@Transactional
|
||||
public static class TestWithSingleMethodOverride {
|
||||
static class TestWithSingleMethodOverride {
|
||||
|
||||
public void doSomething() {
|
||||
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
|
||||
@@ -472,7 +472,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public static class TestWithSingleMethodOverrideInverted {
|
||||
static class TestWithSingleMethodOverrideInverted {
|
||||
|
||||
@Transactional
|
||||
public void doSomething() {
|
||||
@@ -493,7 +493,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
|
||||
|
||||
@Transactional
|
||||
public static class TestWithMultiMethodOverride {
|
||||
static class TestWithMultiMethodOverride {
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public void doSomething() {
|
||||
@@ -515,7 +515,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
|
||||
|
||||
@Transactional
|
||||
public static class TestWithExceptions {
|
||||
static class TestWithExceptions {
|
||||
|
||||
public void doSomethingErroneous() {
|
||||
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
|
||||
@@ -545,7 +545,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public static class TestWithReactive {
|
||||
static class TestWithReactive {
|
||||
|
||||
public Mono<Void> monoSuccess() {
|
||||
return Mono.delay(Duration.ofSeconds(10)).then();
|
||||
@@ -565,7 +565,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public static class TestWithVavrTry {
|
||||
static class TestWithVavrTry {
|
||||
|
||||
public Try<String> doSomething() {
|
||||
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isTrue();
|
||||
@@ -594,14 +594,14 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
|
||||
public interface BaseInterface {
|
||||
interface BaseInterface {
|
||||
|
||||
void doSomething();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public interface TestWithInterface extends BaseInterface {
|
||||
interface TestWithInterface extends BaseInterface {
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
void doSomethingElse();
|
||||
@@ -613,7 +613,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
|
||||
public static class TestWithInterfaceImpl implements TestWithInterface {
|
||||
static class TestWithInterfaceImpl implements TestWithInterface {
|
||||
|
||||
@Override
|
||||
public void doSomething() {
|
||||
@@ -629,7 +629,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
|
||||
public interface SomeService {
|
||||
interface SomeService {
|
||||
|
||||
void foo();
|
||||
|
||||
@@ -641,7 +641,7 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
|
||||
public static class SomeServiceImpl implements SomeService {
|
||||
static class SomeServiceImpl implements SomeService {
|
||||
|
||||
@Override
|
||||
public void bar() {
|
||||
@@ -659,14 +659,14 @@ public class AnnotationTransactionInterceptorTests {
|
||||
}
|
||||
|
||||
|
||||
public interface OtherService {
|
||||
interface OtherService {
|
||||
|
||||
void foo();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public static class OtherServiceImpl implements OtherService {
|
||||
static class OtherServiceImpl implements OtherService {
|
||||
|
||||
@Override
|
||||
public void foo() {
|
||||
|
||||
Reference in New Issue
Block a user