> Hi Carsten,
> This sounds reasonable, can you send me a diff of your patch? I'll
> incorporate it.
> --
> Cédric
> On Mon, Nov 2, 2009 at 9:23 AM, Carsten
> <carsten.guberna...@googlemail.com>wrote:
> > Hi,
> > we use factory classes to generate sample test-cases, often with inner
> > classes.
> > TestNG seems not to like inner test-classes like
> > public class TestCaseFactory
> > {
> > class MyTestClass
> > {
> > @Test
> > public void testAll()
> > {
> > }
> > }
> > @Factory
> > public Object[] createTestCases()
> > {
> > Object[] testCases = new Object[1];
> > testCases[0] = new MyTestClass() // create an inner class
> > - testng tries to execute this inner class
> > {
> > };
> > return testCases;
> > }
> > }
> > When executing the Factory class (which is not supposed to be a test
> > at all) i get the following error message:
> > java.lang.IllegalAccessException: Class
> > org.testng.internal.MethodHelper can not access a member of class
> > test.recommind.utility.TestCaseFactory$MyTestClass with modifiers
> > "public"
> > ... Removed 20 stack frames
> > We still use testng 5.8 and i debugged into it. Filtering these inner
> > classes in ClassHelper solved the problem for us:
> > public static <T> T tryOtherConstructor(Class<T> declaringClass)
> > {
> > if (declaringClass.getModifiers() == 0)
> > {
> > return null;
> > }
> > // remaining code...
> > }
> > The class modifiers are defined here:
> >http://java.sun.com/docs/books/jvms/first_edition/html/ClassFile.doc....
> > I couldn't find modifier 0, but it applies to inner classes. Is it
> > possible to add the code fragment to TestNG? Then we do not have to
> > use custom testng-code.
> > Thanks,
> > Carsten