Author: husted
Date: Thu Sep 28 09:03:13 2006
New Revision: 450909
URL: http://svn.apache.org/viewvc?view=rev&rev=450909
Log:
Add stack trace to unit test failures.
Modified:
struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
Modified: struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs?view=diff&rev=450909&r1=450908&r2=450909
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs Thu Sep 28
09:03:13 2006
@@ -94,6 +94,16 @@
}
return found;
}
+
+ protected void FaultText(Exception fault)
+ {
+ StringBuilder text = new StringBuilder("[");
+ text.Append(fault.Message);
+ text.Append("] ");
+ text.Append(fault.Source);
+ text.Append(fault.StackTrace);
+ Assert.Fail(text.ToString());
+ }
/// <summary>
/// Convenience method to confirm that no Exception was caught.
@@ -102,9 +112,20 @@
///
public void AssertNoFault(IRequestContext context)
{
- bool hasFault = context.HasFault;
- if (hasFault)
- Assert.Fail(context.Fault.Message);
+ if (context.HasFault)
+ {
+ FaultText(context.Fault);
+ }
+ }
+
+ /// <summary>
+ /// Convenience method to confirm that no Exception was caught.
+ /// </summary>
+ /// <param name="helper">Helper under test</param>
+ ///
+ public void AssertNoFault(IViewHelper helper )
+ {
+ FaultText(helper.Fault);
}
/// <summary>
@@ -149,9 +170,7 @@
///
public void AssertNominal(IViewHelper helper)
{
- bool hasFault = helper.HasFault;
- if (hasFault)
- Assert.Fail(helper.Fault.Message);
+ AssertNoFault(helper);
bool hasAlerts = helper.HasAlerts;
if (hasAlerts)