This commit is contained in:
Stéphane Nicoll
2024-01-15 11:17:11 +01:00
parent e1236a8672
commit 0c42965fc3
71 changed files with 543 additions and 828 deletions

View File

@@ -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.
@@ -75,7 +75,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
}
@Test
void testRequestScoping() throws Exception {
void testRequestScoping() {
MockHttpServletRequest oldRequest = new MockHttpServletRequest();
MockHttpServletRequest newRequest = new MockHttpServletRequest();
@@ -103,7 +103,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
}
@Test
void testSessionScoping() throws Exception {
void testSessionScoping() {
MockHttpSession oldSession = new MockHttpSession();
MockHttpSession newSession = new MockHttpSession();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@@ -16,7 +16,6 @@
package org.springframework.aop.framework.autoproxy;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.List;
@@ -61,12 +60,12 @@ class AdvisorAutoProxyCreatorIntegrationTests {
/**
* Return a bean factory with attributes and EnterpriseServices configured.
*/
protected BeanFactory getBeanFactory() throws IOException {
protected BeanFactory getBeanFactory() {
return new ClassPathXmlApplicationContext(DEFAULT_CONTEXT, CLASS);
}
@Test
void testDefaultExclusionPrefix() throws Exception {
void testDefaultExclusionPrefix() {
DefaultAdvisorAutoProxyCreator aapc = (DefaultAdvisorAutoProxyCreator) getBeanFactory().getBean(ADVISOR_APC_BEAN_NAME);
assertThat(aapc.getAdvisorBeanNamePrefix()).isEqualTo((ADVISOR_APC_BEAN_NAME + DefaultAdvisorAutoProxyCreator.SEPARATOR));
assertThat(aapc.isUsePrefix()).isFalse();
@@ -76,21 +75,21 @@ class AdvisorAutoProxyCreatorIntegrationTests {
* If no pointcuts match (no attrs) there should be proxying.
*/
@Test
void testNoProxy() throws Exception {
void testNoProxy() {
BeanFactory bf = getBeanFactory();
Object o = bf.getBean("noSetters");
assertThat(AopUtils.isAopProxy(o)).isFalse();
}
@Test
void testTxIsProxied() throws Exception {
void testTxIsProxied() {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
assertThat(AopUtils.isAopProxy(test)).isTrue();
}
@Test
void testRegexpApplied() throws Exception {
void testRegexpApplied() {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
MethodCounter counter = (MethodCounter) bf.getBean("countingAdvice");
@@ -100,7 +99,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
}
@Test
void testTransactionAttributeOnMethod() throws Exception {
void testTransactionAttributeOnMethod() {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
@@ -166,7 +165,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
}
@Test
void testProgrammaticRollback() throws Exception {
void testProgrammaticRollback() {
BeanFactory bf = getBeanFactory();
Object bean = bf.getBean(TXMANAGER_BEAN_NAME);
@@ -250,7 +249,7 @@ class OrderedTxCheckAdvisor extends StaticMethodMatcherPointcutAdvisor implement
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
setAdvice(new TxCountingBeforeAdvice());
}

View File

@@ -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.
@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Brian Clozel
*/
@EnabledIfRuntimeHintsAgent
public class RuntimeHintsAgentTests {
class RuntimeHintsAgentTests {
private static final ClassLoader classLoader = ClassLoader.getSystemClassLoader();
@@ -58,7 +58,7 @@ public class RuntimeHintsAgentTests {
@BeforeAll
public static void classSetup() throws NoSuchMethodException {
static void classSetup() throws NoSuchMethodException {
defaultConstructor = String.class.getConstructor();
toStringMethod = String.class.getMethod("toString");
privateGreetMethod = PrivateClass.class.getDeclaredMethod("greet");

View File

@@ -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.
@@ -39,7 +39,7 @@ class ComponentBeanDefinitionParserTests {
@BeforeAll
void setUp() throws Exception {
void setUp() {
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("component-config.xml", ComponentBeanDefinitionParserTests.class));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@@ -34,7 +34,7 @@ public class ComponentFactoryBean implements FactoryBean<Component> {
}
@Override
public Component getObject() throws Exception {
public Component getObject() {
if (this.children != null && this.children.size() > 0) {
for (Component child : children) {
this.parent.addComponent(child);

View File

@@ -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.
@@ -42,7 +42,6 @@ import static org.assertj.core.api.Assertions.assertThatException;
* @author Chris Beams
* @since 3.1
*/
@SuppressWarnings("resource")
class EnableCachingIntegrationTests {
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@@ -87,7 +87,6 @@ import static org.springframework.core.env.EnvironmentSystemIntegrationTests.Con
* @author Sam Brannen
* @see org.springframework.context.support.EnvironmentIntegrationTests
*/
@SuppressWarnings("resource")
public class EnvironmentSystemIntegrationTests {
private final ConfigurableEnvironment prodEnv = new StandardEnvironment();
@@ -618,7 +617,7 @@ public class EnvironmentSystemIntegrationTests {
@Import({DevConfig.class, ProdConfig.class})
static class Config {
@Bean
public EnvironmentAwareBean envAwareBean() {
EnvironmentAwareBean envAwareBean() {
return new EnvironmentAwareBean();
}
}

View File

@@ -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.
@@ -51,7 +51,6 @@ import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
* @author Juergen Hoeller
* @since 3.1
*/
@SuppressWarnings("resource")
@EnabledForTestGroups(LONG_RUNNING)
class ScheduledAndTransactionalAnnotationIntegrationTests {

View File

@@ -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.
@@ -54,7 +54,6 @@ import static org.assertj.core.api.Assertions.assertThatException;
* @author Sam Brannen
* @since 3.1
*/
@SuppressWarnings("resource")
class EnableTransactionManagementIntegrationTests {
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@@ -27,14 +27,13 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests proving that regardless the proxy strategy used (JDK interface-based vs. CGLIB
* subclass-based), discovery of advice-oriented annotations is consistent.
*
* <p>
* For example, Spring's @Transactional may be declared at the interface or class level,
* and whether interface or subclass proxies are used, the @Transactional annotation must
* be discovered in a consistent fashion.
*
* @author Chris Beams
*/
@SuppressWarnings("resource")
class ProxyAnnotationDiscoveryTests {
@Test