JUnit has a fail("This should not happen") method that you can call, usually
like so:

try {
    // I'd like this to blow up please:
    Thing.kaboom();
    Assert.fail("Thing should have blown up");
} catch (KaBoom e) {
  // expected, do nothing
}

Gary

> -----Original Message-----
> From: __matthewHawthorne [mailto:[EMAIL PROTECTED]
> Sent: Sunday, December 14, 2003 16:05
> To: Jakarta Commons Developers List
> Subject: Re: [lang] JUnit version, broken tests
> 
> Instead of removing it, is it possible to modify the test to "expect"
> the failure?  I'm not familiar with the test or class that you're
> speaking of, but sometimes it's nice to keep tests like this around.
> 
> Maybe catch an expected RuntimeException, or change an assertTrue to an
> assertFalse, etc.?
> 
> 
> 
> 
> Phil Steitz wrote:
> > Stephen Colebourne wrote:
> >
> >> +1, enough time has now passed for JUnit3.8 to be OK
> >>
> >> Stephen
> >
> >
> > Done.  The enum test remains broken, however under JDK 1.4.2.
> >
> > The test that is failing was added to demonstrate the problem referenced
> > in PR 23374.  Since it fails (actually just fails to demonstrate
> > "broken" behavior) under 1.4.2, I would like to remove it.  Any
> > objections to this?
> >
> > Phil
> >
> >>
> >> ----- Original Message -----
> >> From: "Phil Steitz" <[EMAIL PROTECTED]>
> >> To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
> >> Sent: Saturday, December 13, 2003 8:45 PM
> >> Subject: [lang] JUnit version, broken tests
> >>
> >>
> >>
> >>> Some tests (/builder/ShortPrefixToStringStyleTest, ArrayUtils.Test)
> have
> >>> been been added/modified to require Junit 3.8.  I have no problem with
> >>> this; but we need to modify the dependency in project.xml for the
> maven
> >>> build to work in this case.  Any objections to this change?
> >>>
> >>> I am seeing the following failure in the builder tests:
> >>>
> >>> Testcase: testNestedBroken took 0.006 sec
> >>> FAILED
> >>> expected:<0> but was:<3>
> >>> junit.framework.AssertionFailedError: expected:<0> but was:<3>
> >>> at
> >>
> >>
> >>
> org.apache.commons.lang.enum.EnumTest.testNestedBroken(EnumTest.java:432)
> >>
> >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>> at
> >>>
> >>
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39
> >>
> >> )
> >>
> >>> at
> >>>
> >>
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl
> >>
> >> .java:25)
> >>
> >>> I am using Sun Linux JDK 1.4.2
> >>>
> >>> Phil
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to