harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura" <stepan.mish...@gmail.com>
Subject Re: [classlib][test]Is this test necessary?
Date Wed, 23 Aug 2006 04:25:12 GMT
On 8/23/06, Nathan Beyer  wrote:
>
> No, I don't think that's necessary at all. The test should just be testing
> that the Error itself works, like you said, not that the VM throws one
> when
> it runs out of memory. There were other tests like this, that I've cleaned
> up in the past, like an IndexOutOfBoundsExceptionTest that asserted the
> exception was thrown if an array was accessed out of bounds. I thought it
> was just a one-off thing, but it seems there are other tests like that,
> which should be cleaned up.
>
> My opinion is that tests that assert VM behavior should be packaged with
> the
> VM, not the class library.


I agree.

Also I saw unit tests related to VM behaviour like:

SomeException ex = new SomeException();
try {
    throw ex;
} catch(Exception e) {
    assertSame(ex, e);
}

Thanks,
Stepan.

-Nathan
>
>
> > -----Original Message-----
> > From: Paulex Yang [mailto:paulex.yang@gmail.com]
> > Sent: Tuesday, August 22, 2006 10:39 PM
> > To: harmony-dev@incubator.apache.org
> > Subject: [classlib][test]Is this test necessary?
> >
> > The test case
> > below(org.apache.harmony.luni.tests.java.lang.OutOfMemoryErrorTest)
> > generally needs > 250 seconds on my thinkpad:
> >
> >     public void test_Constructor() {
> >         // Test for method java.lang.OutOfMemoryError()
> >         try {
> >             StringBuffer large[] = new StringBuffer[100000];
> >
> >             for (int i = 0; i < large.length; i++)
> >                 large[i] = new StringBuffer(1000000);
> >         } catch (OutOfMemoryError e) {
> >             return;
> >         }
> >         fail("No error generated");
> >     }
> >
> > IMO it is not a unit test of OutOfMemoryError constructor like its name,
> > actually what it tries to test is the JVM memory management
> >
> > I suggest to remove this testcase, at least it can be written like below
> > to get same error thrown much quickly:
> >
> >     StringBuffer large = new StringBuffer(Integer.MAX_VALUE);
> >
> > --
> > Paulex Yang
> > China Software Development Lab
> > IBM
> >
>
> ------------------------------------------------------
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message