harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Avtamonov" <anton.avtamo...@gmail.com>
Subject Re: should strings in exceptions match the reference implementation?
Date Mon, 17 Apr 2006 06:58:50 GMT
On 4/17/06, Mikhail Loenko <mloenko@gmail.com> wrote:
<SNIP>

> Why it is that complicated?
>
> Why one have jump over utility methods in different classes or even folders to
> understand what a 5-line test does?
>
> testSomething() throw OtherException {
>        try {
>            ec.do_something_exceptional();
>            fail("NullPointerException was not thrown!");
>        } catch (NullPointerException e) {
>            //expected
>        }
> }
>
> Let's keep simple things simple

Actually, it is not complicated. Because in the 'client' code you will
have only small and intention-revealing checkes like:

        testExceptionalCase(new NullPointerCase() {
            public void exceptionalAction() throws Exception {
            }
        });

As I told that is well fits into OO conept and garantee you from not
loosing any checks. Besides, it avoid duplication since you write only
absolutely necessary code, not repeating
try {
  ...
  fail(blah-blah-blah)
}
each time...
If you need to check a message you have just to mention it is the constructor...

It doesn't pretend to be the best choice. As I mantioned it was just
how I do that. If you don't find this approach convenient and
duplication-free don't use it :-).

Wishes,
--
Anton Avtamonov,
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message