From 9eb19ac81644a09a7e5f39ac89ca24d134e006a8 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 21 Aug 2009 11:44:38 +0000 Subject: [PATCH] Polishing test annotation declarations and JavaDoc. --- .../test/annotation/DirtiesContext.java | 4 ++-- .../test/annotation/ExpectedException.java | 8 ++++---- .../test/annotation/IfProfileValue.java | 6 +++--- .../test/annotation/NotTransactional.java | 7 +++---- .../ProfileValueSourceConfiguration.java | 14 ++++++------- .../test/annotation/Repeat.java | 12 +++++------ .../test/annotation/Rollback.java | 6 +++--- .../test/annotation/Timed.java | 8 ++++---- .../test/context/ContextConfiguration.java | 16 +++++++-------- .../test/context/TestExecutionListeners.java | 20 +++++++++---------- .../context/transaction/AfterTransaction.java | 9 ++++----- .../transaction/BeforeTransaction.java | 9 ++++----- .../transaction/TransactionConfiguration.java | 8 ++++---- 13 files changed, 62 insertions(+), 65 deletions(-) diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/DirtiesContext.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/DirtiesContext.java index ea9ae8d822..6d0b6e6e77 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/DirtiesContext.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/DirtiesContext.java @@ -53,9 +53,9 @@ import java.lang.annotation.Target; * @author Rod Johnson * @since 2.0 */ -@Target( { ElementType.TYPE, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target( { ElementType.TYPE, ElementType.METHOD }) public @interface DirtiesContext { /** diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/ExpectedException.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/ExpectedException.java index 22faabb2b4..dffd43edb2 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/ExpectedException.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/ExpectedException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2009 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. @@ -25,14 +25,14 @@ import java.lang.annotation.Target; /** * Test annotation to indicate that a test method is required to throw the * specified exception. - * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 */ -@Target( { ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface ExpectedException { Class value(); diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/IfProfileValue.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/IfProfileValue.java index 9d2a6240b4..47d6f57628 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/IfProfileValue.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/IfProfileValue.java @@ -72,10 +72,10 @@ import java.lang.annotation.Target; * @see org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests * @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner */ -@Target( { ElementType.TYPE, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target( { ElementType.TYPE, ElementType.METHOD }) public @interface IfProfileValue { /** diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/NotTransactional.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/NotTransactional.java index 9b3df71806..b32c44d32e 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/NotTransactional.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/NotTransactional.java @@ -24,14 +24,13 @@ import java.lang.annotation.Target; /** * Test annotation to indicate that a method is not transactional. - * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 */ -@Target( { ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface NotTransactional { - } diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java index dafbe4f1a1..5c195c85e8 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2009 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,20 +27,20 @@ import java.lang.annotation.Target; *

* ProfileValueSourceConfiguration is a class-level annotation which is used to * specify what type of {@link ProfileValueSource} to use when retrieving - * profile values configured via the - * {@link IfProfileValue @IfProfileValue} annotation. + * profile values configured via the {@link IfProfileValue + * @IfProfileValue} annotation. *

- * + * * @author Sam Brannen * @since 2.5 * @see ProfileValueSource * @see IfProfileValue * @see ProfileValueUtils */ +@Documented +@Inherited @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -@Inherited -@Documented public @interface ProfileValueSourceConfiguration { /** @@ -48,7 +48,7 @@ public @interface ProfileValueSourceConfiguration { * The type of {@link ProfileValueSource} to use when retrieving * profile values. *

- * + * * @see SystemProfileValueSource */ Class value() default SystemProfileValueSource.class; diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/Repeat.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/Repeat.java index b2e832fac3..f0c7591ac8 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/Repeat.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/Repeat.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -26,16 +26,16 @@ import java.lang.annotation.Target; * Test annotation to indicate that a test method should be invoked repeatedly. *

* Note that the scope of execution to be repeated includes execution of the - * test method itself as well as any set up or tear down - * of the test fixture. - * + * test method itself as well as any set up or tear down of + * the test fixture. + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 */ -@Target( { ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface Repeat { int value() default 1; diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/Rollback.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/Rollback.java index 03c902c341..052b419f95 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/Rollback.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/Rollback.java @@ -27,13 +27,13 @@ import java.lang.annotation.Target; * test method should be rolled back after the test method has * completed. If true, the transaction will be rolled back; * otherwise, the transaction will be committed. - * + * * @author Sam Brannen * @since 2.5 */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface Rollback { /** diff --git a/org.springframework.test/src/main/java/org/springframework/test/annotation/Timed.java b/org.springframework.test/src/main/java/org/springframework/test/annotation/Timed.java index aaba1d92cd..94f7d0df14 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/annotation/Timed.java +++ b/org.springframework.test/src/main/java/org/springframework/test/annotation/Timed.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -36,16 +36,16 @@ import java.lang.annotation.Target; * {@link Repeat repetitions} of the test, and any set up or * tear down of the test fixture. *

- * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 * @see Repeat * @see AbstractAnnotationAwareTransactionalTests */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface Timed { /** diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfiguration.java b/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfiguration.java index 6c0f46a095..d21e8cb429 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfiguration.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/ContextConfiguration.java @@ -27,16 +27,16 @@ import java.lang.annotation.Target; * ContextConfiguration defines class-level metadata which can be used to * instruct client code with regard to how to load and configure an * {@link org.springframework.context.ApplicationContext ApplicationContext}. - * + * * @author Sam Brannen * @since 2.5 * @see ContextLoader * @see org.springframework.context.ApplicationContext */ +@Documented +@Inherited @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -@Inherited -@Documented public @interface ContextConfiguration { /** @@ -62,7 +62,7 @@ public @interface ContextConfiguration { * defined by an annotated superclass. Thus, subclasses have the option of * extending the list of resource locations. In the following * example, the {@link org.springframework.context.ApplicationContext ApplicationContext} - * for ExtendedTest will be loaded from + * for ExtendedTest will be loaded from * "base-context.xml" and * "extended-context.xml", in that order. Beans defined in * "extended-context.xml" may therefore override those defined in @@ -70,12 +70,12 @@ public @interface ContextConfiguration { *
 	 * @ContextConfiguration("base-context.xml")
 	 * public class BaseTest {
-	 *     // ...
+	 * 	// ...
 	 * }
 	 * 
 	 * @ContextConfiguration("extended-context.xml")
 	 * public class ExtendedTest extends BaseTest {
-	 *     // ...
+	 * 	// ...
 	 * }
 	 * 
* If inheritLocations is set to false, the @@ -89,8 +89,8 @@ public @interface ContextConfiguration { * {@link org.springframework.context.ApplicationContext ApplicationContext}. *

If not specified, the loader will be inherited from the first superclass * which is annotated with @ContextConfiguration and specifies - * an explicit loader. If no class in the hierarchy specifies an explicit - * loader, a default loader will be used instead. + * an explicit loader. If no class in the hierarchy specifies an explicit + * loader, a default loader will be used instead. */ Class loader() default ContextLoader.class; diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/TestExecutionListeners.java b/org.springframework.test/src/main/java/org/springframework/test/context/TestExecutionListeners.java index 390a509876..b9e6e9cb10 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/TestExecutionListeners.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/TestExecutionListeners.java @@ -29,17 +29,17 @@ import java.lang.annotation.Target; * be registered with a {@link TestContextManager}. Typically, * @TestExecutionListeners will be used in conjunction with * {@link ContextConfiguration @ContextConfiguration}. - * + * * @author Sam Brannen * @since 2.5 * @see TestExecutionListener * @see TestContextManager * @see ContextConfiguration */ +@Documented +@Inherited @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -@Inherited -@Documented public @interface TestExecutionListeners { /** @@ -47,7 +47,7 @@ public @interface TestExecutionListeners { * The {@link TestExecutionListener TestExecutionListeners} to register with * a {@link TestContextManager}. *

- * + * * @see org.springframework.test.context.support.DependencyInjectionTestExecutionListener * @see org.springframework.test.context.support.DirtiesContextTestExecutionListener * @see org.springframework.test.context.transaction.TransactionalTestExecutionListener @@ -73,20 +73,20 @@ public @interface TestExecutionListeners { * DirtiesContextTestExecutionListener, and * TransactionalTestExecutionListener, in that order. *

- * + * *
 	 * @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class,
-	 *     DirtiesContextTestExecutionListener.class })
+     *    DirtiesContextTestExecutionListener.class })
 	 * public abstract class AbstractBaseTest {
-	 *     // ...
+	 * 	// ...
 	 * }
-	 *
+	 * 
 	 * @TestExecutionListeners(TransactionalTestExecutionListener.class)
 	 * public class TransactionalTest extends AbstractBaseTest {
-	 *     // ...
+	 * 	// ...
 	 * }
 	 * 
- * + * *

* If inheritListeners is set to false, the * listeners for the annotated class will shadow and effectively diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java b/org.springframework.test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java index 26a7a44c42..7900cf30bf 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2009 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. @@ -33,14 +33,13 @@ import java.lang.annotation.Target; * The @AfterTransaction methods of superclasses will be * executed after those of the current class. *

- * + * * @author Sam Brannen * @since 2.5 * @see org.springframework.transaction.annotation.Transactional */ -@Target( { ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface AfterTransaction { - } diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java b/org.springframework.test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java index 488eaa5d1c..48736b79fd 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2009 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. @@ -33,14 +33,13 @@ import java.lang.annotation.Target; * The @BeforeTransaction methods of superclasses will be * executed before those of the current class. *

- * + * * @author Sam Brannen * @since 2.5 * @see org.springframework.transaction.annotation.Transactional */ -@Target( { ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) @Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface BeforeTransaction { - } diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/transaction/TransactionConfiguration.java b/org.springframework.test/src/main/java/org/springframework/test/context/transaction/TransactionConfiguration.java index 420f35d7a6..98d58635f1 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/transaction/TransactionConfiguration.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/transaction/TransactionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -29,16 +29,16 @@ import org.springframework.transaction.PlatformTransactionManager; /** * TransactionConfiguration defines class-level metadata for configuring * transactional tests. - * + * * @author Sam Brannen * @since 2.5 * @see ContextConfiguration * @see TransactionalTestExecutionListener */ +@Documented +@Inherited @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -@Inherited -@Documented public @interface TransactionConfiguration { /** -- GitLab