import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
\r
+import org.argeo.slc.core.SlcException;\r
+\r
/**\r
* Basic implementation of a test result containing only a list of result parts.\r
*/\r
public class SimpleTestResult implements TestResult {\r
private static Log log = LogFactory.getLog(SimpleTestResult.class);\r
\r
+ private Boolean throwError = true;\r
+\r
private TestResultId testResultId;\r
private Date closeDate;\r
private List<TestResultPart> parts = new Vector<TestResultPart>();\r
\r
public void addResultPart(TestResultPart part) {\r
+ if (throwError && part.getStatus() == ERROR) {\r
+ throw new SlcException("There was an error in the underlying test",\r
+ part.getException());\r
+ }\r
parts.add(part);\r
if (log.isDebugEnabled())\r
log.debug(part);\r
return closeDate;\r
}\r
\r
+ public void setThrowError(Boolean throwError) {\r
+ this.throwError = throwError;\r
+ }\r
+\r
}\r
import java.util.Date;\r
\r
/** The result of a test */\r
-public interface TestResult {\r
+public interface TestResult extends TestStatus {\r
/** Gets the id of the related test result. */\r
public TestResultId getTestResultId();\r
\r
* @see TestResult\r
*/\r
public interface TestResultPart {\r
+ /** The status, as defined in {@link TestStatus}. */\r
public Integer getStatus();\r
\r
+ /** The related message. */\r
public String getMessage();\r
+\r
+ /** The underlying <code>Exception</code>. Can be null. */\r
+ public Exception getException();\r
}\r