Permalink
Browse files

Fix formatting

  • Loading branch information...
1 parent dc44abf commit bb91daf8e0939d787ffb5a3eda05c2d626cd9851 @kcooney committed Oct 24, 2012
@@ -44,13 +44,14 @@
* @Override
* protected void before() throws Throwable {
* myServer.connect();
- * }
+ * }
*
* @Override
* protected void after() {
* myServer.disconnect();
- * }
- * };
+ * }
+ * };
+ * }
* </pre>
*
* and the same using a method
@@ -8,12 +8,12 @@
/**
* Annotates fields that reference rules or methods that return a rule. A field must be public, not
* static, and a subtype of {@link org.junit.rules.TestRule} (preferred) or
- * {@link org.junit.rules.MethodRule}. A method must be public, not static
+ * {@link org.junit.rules.MethodRule}. A method must be public, not static,
* and must return a subtype of {@link org.junit.rules.TestRule} (preferred) or
* {@link org.junit.rules.MethodRule}.<p>
*
- * The {@link org.junit.runners.model.Statement} passed
- * to the {@link org.junit.rules.TestRule} will run any {@link Before} methods,
+ * The {@link org.junit.runners.model.Statement} passed
+ * to the {@link org.junit.rules.TestRule} will run any {@link Before} methods,
* then the {@link Test} method, and finally any {@link After} methods,
* throwing an exception if any of these fail. If there are multiple
* annotated {@link Rule}s on a class, they will be applied in order of fields first, then methods.
@@ -38,13 +38,34 @@
* }
* }
* </pre>
- *
- * For more information and more examples, see
- * {@link org.junit.rules.TestRule}.
+ *
+ * And the same using a method.
+ *
+ * <pre>
+ * public static class HasTempFolder {
+ * private TemporaryFolder folder= new TemporaryFolder();
+ *
+ * &#064;Rule
+ * public TemporaryFolder getFolder() {
+ * return folder;
+ * }
+ *
+ * &#064;Test
+ * public void testUsingTempFolder() throws IOException {
+ * File createdFile= folder.newFile(&quot;myfile.txt&quot;);
+ * File createdFolder= folder.newFolder(&quot;subfolder&quot;);
+ * // ...
+ * }
+ * }
+ * </pre>
+ *
+ * For more information and more examples, see
+ * {@link org.junit.rules.TestRule}.
+ *
* @since 4.7
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface Rule {
-}
+}
@@ -23,21 +23,22 @@
* <li>{@link Timeout}: cause test to fail after a set time</li>
* <li>{@link Verifier}: fail test if object state ends up incorrect</li>
* </ul>
- *
+ *
* Note that {@link MethodRule} has been replaced by {@link TestRule},
* which has the added benefit of supporting class rules.
+ *
* @since 4.7
*/
public interface MethodRule {
- /**
- * Modifies the method-running {@link Statement} to implement an additional
- * test-running rule.
- *
- * @param base The {@link Statement} to be modified
- * @param method The method to be run
- * @param target The object on with the method will be run.
- * @return a new statement, which may be the same as {@code base},
- * a wrapper around {@code base}, or a completely new Statement.
- */
- Statement apply(Statement base, FrameworkMethod method, Object target);
-}
+ /**
+ * Modifies the method-running {@link Statement} to implement an additional
+ * test-running rule.
+ *
+ * @param base The {@link Statement} to be modified
+ * @param method The method to be run
+ * @param target The object on with the method will be run.
+ * @return a new statement, which may be the same as {@code base},
+ * a wrapper around {@code base}, or a completely new Statement.
+ */
+ Statement apply(Statement base, FrameworkMethod method, Object target);
+}
@@ -37,11 +37,9 @@
* }
* }
* </pre>
- *
- * @deprecated Use {@link TestWatcher} (which implements {@link TestRule}) instead.
+ *
* @since 4.7
- * @deprecated {@link MethodRule} is deprecated.
- * Use {@link TestWatcher} implements {@link TestRule} instead.
+ * @deprecated Use {@link TestWatcher} (which implements {@link TestRule}) instead.
*/
@Deprecated
public class TestWatchman implements MethodRule {
Oops, something went wrong.

0 comments on commit bb91daf

Please sign in to comment.