From 11383f27fb353b3864cbbc292070690163c692d1 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Sat, 14 May 2011 06:44:51 +0000 Subject: [PATCH] SPR-8336 - Fixed broken test case. Converted the test to JUnit 4. git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4309 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../core/type/AnnotationTypeFilterTests.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/org.springframework.core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java b/org.springframework.core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java index 68841aca1db..e9d8c1e19de 100644 --- a/org.springframework.core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java +++ b/org.springframework.core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java @@ -16,8 +16,11 @@ package org.springframework.core.type; +import static org.junit.Assert.*; + import java.lang.annotation.Inherited; +import org.junit.Test; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; @@ -27,9 +30,11 @@ import org.springframework.stereotype.Component; /** * @author Ramnivas Laddad * @author Juergen Hoeller + * @author Oliver Gierke */ -public class AnnotationTypeFilterTests extends TestCase { +public class AnnotationTypeFilterTests { + @Test public void testDirectAnnotationMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeComponent"; @@ -40,6 +45,7 @@ public class AnnotationTypeFilterTests extends TestCase { ClassloadingAssertions.assertClassNotLoaded(classUnderTest); } + @Test public void testInheritedAnnotationFromInterfaceDoesNotMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeSubClassOfSomeComponentInterface"; @@ -51,6 +57,7 @@ public class AnnotationTypeFilterTests extends TestCase { ClassloadingAssertions.assertClassNotLoaded(classUnderTest); } + @Test public void testInheritedAnnotationFromBaseClassDoesMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeSubClassOfSomeComponent"; @@ -61,6 +68,7 @@ public class AnnotationTypeFilterTests extends TestCase { ClassloadingAssertions.assertClassNotLoaded(classUnderTest); } + @Test public void testNonInheritedAnnotationDoesNotMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation"; @@ -72,6 +80,7 @@ public class AnnotationTypeFilterTests extends TestCase { ClassloadingAssertions.assertClassNotLoaded(classUnderTest); } + @Test public void testNonAnnotatedClassDoesntMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AnnotationTypeFilterTests$SomeNonCandidateClass"; @@ -82,6 +91,7 @@ public class AnnotationTypeFilterTests extends TestCase { ClassloadingAssertions.assertClassNotLoaded(classUnderTest); } + @Test public void testMatchesInterfacesIfConfigured() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();