diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/ShouldBeConfiguredBySpring.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/ShouldBeConfiguredBySpring.java new file mode 100644 index 0000000000..facb622cb0 --- /dev/null +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/ShouldBeConfiguredBySpring.java @@ -0,0 +1,37 @@ +/* + * Copyright 2002-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.beans.factory.aspectj; + +import java.io.Serializable; + +import org.springframework.beans.factory.annotation.Configurable; + +@Configurable("configuredBean") +@SuppressWarnings("serial") +public class ShouldBeConfiguredBySpring implements Serializable { + + private String name; + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/XmlBeanConfigurerTests.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/XmlBeanConfigurerTests.java index c5cc835a3d..371c664d1a 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/XmlBeanConfigurerTests.java +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/XmlBeanConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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,23 +16,22 @@ package org.springframework.beans.factory.aspectj; -import org.springframework.context.ConfigurableApplicationContext; +import org.junit.Assert; +import org.junit.Test; + import org.springframework.context.support.ClassPathXmlApplicationContext; /** * @author Chris Beams */ -public class XmlBeanConfigurerTests extends AbstractBeanConfigurerTests { - - @Override - protected ConfigurableApplicationContext createContext() { - return new ClassPathXmlApplicationContext("org/springframework/beans/factory/aspectj/beanConfigurerTests.xml"); - } +public class XmlBeanConfigurerTests { - public void testInjectionAfterRefresh() { - context.refresh(); + @Test + public void testInjection() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( + "org/springframework/beans/factory/aspectj/beanConfigurerTests.xml"); ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring(); - assertEquals("Rod", myObject.getName()); + Assert.assertEquals("Rod", myObject.getName()); } } diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml index bd6439bb54..a850a42bda 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml @@ -1,64 +1,10 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-aspects/src/test/java/org/springframework/context/annotation/aspectj/AnnotationBeanConfigurerTests.java b/spring-aspects/src/test/java/org/springframework/context/annotation/aspectj/AnnotationBeanConfigurerTests.java index 69dc45b277..1baf04c296 100644 --- a/spring-aspects/src/test/java/org/springframework/context/annotation/aspectj/AnnotationBeanConfigurerTests.java +++ b/spring-aspects/src/test/java/org/springframework/context/annotation/aspectj/AnnotationBeanConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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,31 +16,36 @@ package org.springframework.context.annotation.aspectj; -import org.springframework.beans.factory.aspectj.AbstractBeanConfigurerTests; -import org.springframework.context.ConfigurableApplicationContext; +import org.junit.Assert; +import org.junit.Test; + +import org.springframework.beans.factory.aspectj.ShouldBeConfiguredBySpring; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; -import org.springframework.context.annotation.aspectj.EnableSpringConfigured; /** * Tests that @EnableSpringConfigured properly registers an - * {@link org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect}, just - * as does {@code } + * {@link org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect}, + * just as does {@code }. * * @author Chris Beams * @since 3.1 */ -public class AnnotationBeanConfigurerTests extends AbstractBeanConfigurerTests { +public class AnnotationBeanConfigurerTests { - @Override - protected ConfigurableApplicationContext createContext() { - return new AnnotationConfigApplicationContext(Config.class); + @Test + public void testInjection() { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class); + ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring(); + Assert.assertEquals("Rod", myObject.getName()); } + @Configuration @ImportResource("org/springframework/beans/factory/aspectj/beanConfigurerTests-beans.xml") @EnableSpringConfigured static class Config { } + }