Title: [1008] trunk/jbehave-core/src/java/org/jbehave/scenario/errors: JBEHAVE-147: Added javadocs.
Revision
1008
Author
mauro
Date
2008-11-06 02:53:53 -0600 (Thu, 06 Nov 2008)

Log Message

JBEHAVE-147:  Added javadocs.  Simplified exception message - which was potentially ambiguous.

Modified Paths

Diff

Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/errors/BeforeOrAfterScenarioException.java (1007 => 1008)

--- trunk/jbehave-core/src/java/org/jbehave/scenario/errors/BeforeOrAfterScenarioException.java	2008-11-02 10:57:28 UTC (rev 1007)
+++ trunk/jbehave-core/src/java/org/jbehave/scenario/errors/BeforeOrAfterScenarioException.java	2008-11-06 08:53:53 UTC (rev 1008)
@@ -1,19 +1,25 @@
 package org.jbehave.scenario.errors;
 
+import static java.text.MessageFormat.format;
+
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 
-import org.jbehave.scenario.steps.Steps;
+import org.jbehave.scenario.annotations.AfterScenario;
+import org.jbehave.scenario.annotations.BeforeScenario;
 
+/**
+ * Thrown when methods annotated with [EMAIL PROTECTED] BeforeScenario @BeforeScenario} or
+ * [EMAIL PROTECTED] AfterScenario @AfterScenario} fail.
+ */
[EMAIL PROTECTED]("serial")
 public class BeforeOrAfterScenarioException extends RuntimeException {
 
-	private static final long serialVersionUID = 8025578549612669575L;
+	private static final String MESSAGE = "Method {0}.{1}, annotated with {2} failed.";
 
-	public BeforeOrAfterScenarioException(Class<? extends Annotation> annotation, Method method, Throwable t) {
-		super("Method " + method.getClass().getSimpleName() + "." + method.getName() + 
-				", annotated with " + annotation.getSimpleName() + " failed. Please note that " +
-				Steps.class.getSimpleName() + " methods annotated with " +
-				"this type of annotation should not take parameters, and any exceptions generated by them " +
-				"cannot be handled by JBehave.", t);
+	public BeforeOrAfterScenarioException(
+			Class<? extends Annotation> annotation, Method method, Throwable t) {
+		super(format(MESSAGE, method.getClass().getSimpleName(),
+				method.getName(), annotation.getSimpleName()), t);
 	}
 }

Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/errors/ErrorStrategy.java (1007 => 1008)

--- trunk/jbehave-core/src/java/org/jbehave/scenario/errors/ErrorStrategy.java	2008-11-02 10:57:28 UTC (rev 1007)
+++ trunk/jbehave-core/src/java/org/jbehave/scenario/errors/ErrorStrategy.java	2008-11-06 08:53:53 UTC (rev 1008)
@@ -1,13 +1,32 @@
 package org.jbehave.scenario.errors;
 
+/**
+ * ErrorStrategy allows to define error handling strategies. Two standard
+ * strategies are provided:
+ * <ul>
+ * <li>[EMAIL PROTECTED] SILENT}: silently absorbs the error</li>
+ * <li>[EMAIL PROTECTED] RETHROW}: rethrows the error</li>
+ * </ul>
+ */
 public interface ErrorStrategy {
 
-    ErrorStrategy SILENT = new ErrorStrategy(){ public void handleError(Throwable throwable) {}};
-    ErrorStrategy RETHROW = new ErrorStrategy() {
-        public void handleError(Throwable throwable) throws Throwable {
-            throw throwable;
-        }};
-        
-    void handleError(Throwable throwable) throws Throwable;
+	/**
+	 * Strategy that silently absorbs the error
+	 */
+	ErrorStrategy SILENT = new ErrorStrategy() {
+		public void handleError(Throwable throwable) {
+		}
+	};
+	
+	/**
+	 * Strategy that rethrows the error
+	 */
+	ErrorStrategy RETHROW = new ErrorStrategy() {
+		public void handleError(Throwable throwable) throws Throwable {
+			throw throwable;
+		}
+	};
 
+	void handleError(Throwable throwable) throws Throwable;
+
 }

Modified: trunk/jbehave-core/src/java/org/jbehave/scenario/errors/PendingErrorStrategy.java (1007 => 1008)

--- trunk/jbehave-core/src/java/org/jbehave/scenario/errors/PendingErrorStrategy.java	2008-11-02 10:57:28 UTC (rev 1007)
+++ trunk/jbehave-core/src/java/org/jbehave/scenario/errors/PendingErrorStrategy.java	2008-11-06 08:53:53 UTC (rev 1008)
@@ -1,15 +1,29 @@
 package org.jbehave.scenario.errors;
 
-
+/**
+ * PendingErrorStrategy allows to define how pending error are handled. Two
+ * standard strategies are provided:
+ * <ul>
+ * <li>[EMAIL PROTECTED] PASSING}: passes scenarios upon pending errors</li>
+ * <li>[EMAIL PROTECTED] FAILING}: fails scenario upon pending errors</li>
+ * </ul>
+ */
 public interface PendingErrorStrategy extends ErrorStrategy {
 
-    PendingErrorStrategy PASSING = new PendingErrorStrategy() { 
-        public void handleError(Throwable throwable) {}
-    };
-    
-    PendingErrorStrategy FAILING = new PendingErrorStrategy() {
-        public void handleError(Throwable throwable) throws Throwable {
-            throw throwable;
-        } 
-    };
+	/**
+	 * Strategy that passes scenarios upon pending errors
+	 */
+	PendingErrorStrategy PASSING = new PendingErrorStrategy() {
+		public void handleError(Throwable throwable) {
+		}
+	};
+
+	/**
+	 * Strategy that fails scenario upon pending errors
+	 */
+	PendingErrorStrategy FAILING = new PendingErrorStrategy() {
+		public void handleError(Throwable throwable) throws Throwable {
+			throw throwable;
+		}
+	};
 }


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to