@ -1,5 +1,5 @@
@@ -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 .
@ -19,9 +19,9 @@ package org.springframework.aop.config;
@@ -19,9 +19,9 @@ package org.springframework.aop.config;
import org.junit.jupiter.api.Test ;
import org.springframework.beans.factory.BeanDefinitionStoreException ;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException ;
import org.springframework.beans.factory.support.DefaultListableBeanFactory ;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader ;
import org.springframework.core.io.ClassPathResource ;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType ;
import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifiedResource ;
@ -29,25 +29,28 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
@@ -29,25 +29,28 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
/ * *
* @author Mark Fisher
* @author Chris Beams
* @author Sam Brannen
* /
class AopNamespaceHandlerPointcutErrorTests {
@Test
void duplicatePointcutConfig ( ) {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory ( ) ;
assertThatExceptionOfType ( BeanDefinitionStoreException . class ) . isThrownBy ( ( ) - >
new XmlBeanDefinitionReader ( bf ) . loadBeanDefinitions (
qualifiedResource ( getClass ( ) , "pointcutDuplication.xml" ) ) )
. satisfies ( ex - > ex . contains ( BeanDefinitionParsingException . class ) ) ;
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader ( bf ) ;
ClassPathResource resource = qualifiedResource ( getClass ( ) , "pointcutDuplication.xml" ) ;
assertThatExceptionOfType ( BeanDefinitionStoreException . class )
. isThrownBy ( ( ) - > reader . loadBeanDefinitions ( resource ) ) ;
}
@Test
void missingPointcutConfig ( ) {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory ( ) ;
assertThatExceptionOfType ( BeanDefinitionStoreException . class ) . isThrownBy ( ( ) - >
new XmlBeanDefinitionReader ( bf ) . loadBeanDefinitions (
qualifiedResource ( getClass ( ) , "pointcutMissing.xml" ) ) )
. satisfies ( ex - > ex . contains ( BeanDefinitionParsingException . class ) ) ;
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader ( bf ) ;
ClassPathResource resource = qualifiedResource ( getClass ( ) , "pointcutMissing.xml" ) ;
assertThatExceptionOfType ( BeanDefinitionStoreException . class )
. isThrownBy ( ( ) - > reader . loadBeanDefinitions ( resource ) ) ;
}
}