Polishing

This commit is contained in:
Juergen Hoeller
2017-04-26 18:20:19 +02:00
parent 3daf626842
commit c668d9a473
8 changed files with 42 additions and 36 deletions

View File

@@ -91,7 +91,7 @@ public class AnnotationUtilsTests {
assertNotNull(findAnnotation(m, Order.class));
}
/** @since 4.2 */
// @since 4.2
@Test
public void findMethodAnnotationWithAnnotationOnMethodInInterface() throws Exception {
Method m = Leaf.class.getMethod("fromInterfaceImplementedByRoot");
@@ -103,7 +103,7 @@ public class AnnotationUtilsTests {
assertNotNull(findAnnotation(m, Order.class));
}
/** @since 4.2 */
// @since 4.2
@Test
public void findMethodAnnotationWithMetaAnnotationOnLeaf() throws Exception {
Method m = Leaf.class.getMethod("metaAnnotatedOnLeaf");
@@ -112,7 +112,7 @@ public class AnnotationUtilsTests {
assertNotNull(findAnnotation(m, Order.class));
}
/** @since 4.2 */
// @since 4.2
@Test
public void findMethodAnnotationWithMetaMetaAnnotationOnLeaf() throws Exception {
Method m = Leaf.class.getMethod("metaMetaAnnotatedOnLeaf");
@@ -129,7 +129,7 @@ public class AnnotationUtilsTests {
assertNotNull(findAnnotation(m, Order.class));
}
/** @since 4.2 */
// @since 4.2
@Test
public void findMethodAnnotationWithMetaAnnotationOnRoot() throws Exception {
Method m = Leaf.class.getMethod("metaAnnotatedOnRoot");
@@ -259,42 +259,42 @@ public class AnnotationUtilsTests {
assertNull("Should not find @Component on MetaCycleAnnotatedClass", component);
}
/** @since 4.2 */
// @since 4.2
@Test
public void findClassAnnotationOnInheritedAnnotationInterface() {
Transactional tx = findAnnotation(InheritedAnnotationInterface.class, Transactional.class);
assertNotNull("Should find @Transactional on InheritedAnnotationInterface", tx);
}
/** @since 4.2 */
// @since 4.2
@Test
public void findClassAnnotationOnSubInheritedAnnotationInterface() {
Transactional tx = findAnnotation(SubInheritedAnnotationInterface.class, Transactional.class);
assertNotNull("Should find @Transactional on SubInheritedAnnotationInterface", tx);
}
/** @since 4.2 */
// @since 4.2
@Test
public void findClassAnnotationOnSubSubInheritedAnnotationInterface() {
Transactional tx = findAnnotation(SubSubInheritedAnnotationInterface.class, Transactional.class);
assertNotNull("Should find @Transactional on SubSubInheritedAnnotationInterface", tx);
}
/** @since 4.2 */
// @since 4.2
@Test
public void findClassAnnotationOnNonInheritedAnnotationInterface() {
Order order = findAnnotation(NonInheritedAnnotationInterface.class, Order.class);
assertNotNull("Should find @Order on NonInheritedAnnotationInterface", order);
}
/** @since 4.2 */
// @since 4.2
@Test
public void findClassAnnotationOnSubNonInheritedAnnotationInterface() {
Order order = findAnnotation(SubNonInheritedAnnotationInterface.class, Order.class);
assertNotNull("Should find @Order on SubNonInheritedAnnotationInterface", order);
}
/** @since 4.2 */
// @since 4.2
@Test
public void findClassAnnotationOnSubSubNonInheritedAnnotationInterface() {
Order order = findAnnotation(SubSubNonInheritedAnnotationInterface.class, Order.class);
@@ -1241,12 +1241,9 @@ public class AnnotationUtilsTests {
assertEquals("location: ", "", contextConfig.location());
}
@ContextConfig(value="foo", location="bar")
@Test(expected=AnnotationConfigurationException.class)
@Test(expected = AnnotationConfigurationException.class)
public void synthesizeAnnotationWithAttributeAliasesDifferentValues() throws Exception {
Method m = AnnotationUtilsTests.class.getDeclaredMethod("synthesizeAnnotationWithAttributeAliasesDifferentValues");
Annotation a = synthesizeAnnotation(m.getDeclaredAnnotation(ContextConfig.class));
getValue(a);
getValue(synthesizeAnnotation(ContextConfigMismatch.class.getAnnotation(ContextConfig.class)));
}
@Test
@@ -1823,13 +1820,13 @@ public class AnnotationUtilsTests {
interface InterfaceWithRepeated {
@MyRepeatable("A")
@MyRepeatableContainer({ @MyRepeatable("B"), @MyRepeatable("C") })
@MyRepeatableContainer({@MyRepeatable("B"), @MyRepeatable("C")})
@MyRepeatableMeta1
void foo();
}
@MyRepeatable("A")
@MyRepeatableContainer({ @MyRepeatable("B"), @MyRepeatable("C") })
@MyRepeatableContainer({@MyRepeatable("B"), @MyRepeatable("C")})
@MyRepeatableMeta1
static class MyRepeatableClass {
}
@@ -1838,7 +1835,7 @@ public class AnnotationUtilsTests {
}
@MyRepeatable("X")
@MyRepeatableContainer({ @MyRepeatable("Y"), @MyRepeatable("Z") })
@MyRepeatableContainer({@MyRepeatable("Y"), @MyRepeatable("Z")})
@MyRepeatableMeta2
static class SubMyRepeatableWithAdditionalLocalDeclarationsClass extends MyRepeatableClass {
}
@@ -1968,7 +1965,7 @@ public class AnnotationUtilsTests {
BrokenContextConfig[] value();
}
@Hierarchy({ @ContextConfig("A"), @ContextConfig(location = "B") })
@Hierarchy({@ContextConfig("A"), @ContextConfig(location = "B")})
static class ConfigHierarchyTestCase {
}
@@ -2320,7 +2317,7 @@ public class AnnotationUtilsTests {
Filter[] excludeFilters() default {};
}
@ComponentScan(excludeFilters = { @Filter(pattern = "*Foo"), @Filter(pattern = "*Bar") })
@ComponentScan(excludeFilters = {@Filter(pattern = "*Foo"), @Filter(pattern = "*Bar")})
static class ComponentScanClass {
}
@@ -2348,4 +2345,8 @@ public class AnnotationUtilsTests {
String text();
}
@ContextConfig(value = "foo", location = "bar")
interface ContextConfigMismatch {
}
}