|
Re: FAQ entry critique (Re: Re: distinguishing between failures and errors): msg#00144java.junit.user
J. B. Rainsberger wrote: >> >> public void testNonexistentFileRead() throws IOException { >> try { >> >> File file = new File("doesNotExist.txt"); >> FileReader reader = new FileReader(file); >> assertEquals('a', (char)reader.read()); >> >> fail("Should have thrown FileNotFoundException"); >> > >Suggestion: change the failure message to "Read from a nonexistent file?!". I >prefer this pattern because it indicates what the system did incorrectly in a >higher-level way. I also think it's funnier when I see it in the test >results. ;) > Yeah, and then append "I'm sorry, Dave, I'm afraid I can't do that" to all the failures by default. :-) Mike [Non-text portions of this message have been removed]
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | FAQ entry critique (Re: Re: distinguishing between failures and errors), J. B. Rainsberger |
|---|---|
| Next by Date: | Re: FAQ entry critique (Re: Re: distinguishing between failures and errors), J. B. Rainsberger |
| Previous by Thread: | FAQ entry critique (Re: Re: distinguishing between failures and errors), J. B. Rainsberger |
| Next by Thread: | Re: FAQ entry critique (Re: Re: distinguishing between failures and errors), J. B. Rainsberger |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |