albamatiit wrote:

> I have a class with an assert keyword.
> Now, when an assert fails, the test is marked as "not passed".
> There is a manner to test that the assert fail (I mean in a "positive"
> way, like with the try catch for the exception).

Two options:

1. Assert the logical opposite -- instead of assert x, use assert !x.
2. Use the standard pattern for expecting an exception for the error
class AssertionError. (See c2.com/cgi/wiki?CodingJavaUnitExceptionTests)
--
J. B. (Joe) Rainsberger
Diaspar Software Services
http://www.diasparsoftware.com
Author, JUnit Recipes: Practical Methods for Programmer Testing

Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=294855.5468653.6549235.3001176/D=groups/S=:HM/A=2376776/rand=820854496


Yahoo! Groups Links

Reply via email to