This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 34544 - SimpleJUnitTest abstract class test misses closing braces for void methods in ImplTest
Summary: SimpleJUnitTest abstract class test misses closing braces for void methods in...
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: Marian Petras
URL:
Keywords: SIMPLEFIX
Depends on:
Blocks:
 
Reported: 2003-06-24 00:40 UTC by zacjacobson
Modified: 2004-01-30 09:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zacjacobson 2003-06-24 00:40:18 UTC
Okay, this is kindof weird.. I have an abstract
class, and one of the abstract methods has a
return type of void.

When I generate a SimpleJUnitTest that includes
testing of abstract classes, it's all good EXCEPT
methods that have a void return type.

All that seems to happen is that the closing brace
for each method with a void return type is
deleted, hence leaving the generated class broken.
A new level of indentation is set below the
unclosed method.

Because of this, a dialog asking to add the
missing method comes up, but it doesn't fix the
mis-matched braces issue.

I hope this formats nicely.

-------------- example base
public abstract class Test {
    public void test() {
    }
    protected abstract int testInt();
    protected abstract void testVoid( );
    protected abstract String testString();

}
-------------- end example base
-------------- example test
import junit.framework.*;

public class TestTest extends TestCase {
    
    public TestTest(java.lang.String testName) {
        super(testName);
    }
    
    public static Test suite() {
        TestSuite suite = new
TestSuite(TestTest.class);
        return suite;
    }
    
    /** Test of test method, of class Test. */
    public void testTest() {
        System.out.println("testTest");
        
        // Add your test code below by replacing
the default call to fail.
        fail("The test case is empty.");
    }
    
    /** Generated implementation of abstract class
Test. Please fill dummy bodies of generated
methods. */
    private class TestImpl extends Test {
        
        protected int testInt() {// fill the body
in order to provide useful implementation
            return 0;
        }
        
        protected void testVoid() {// fill the
body in order to provide useful implementation}
        
            protected String testString() {// fill
the body in order to provide useful implementation
                return null;
            }
            
    }
    
    // Add test methods here, they have to start
with 'test' name.
    // for example:
    // public void testHello() {}
    
    
}
-------------- end example test
Comment 1 zacjacobson 2003-06-24 00:43:01 UTC
I mean to be pointing out TestTest.TestImpl.testVoid() as missing its
closing brace.
Comment 2 zacjacobson 2003-06-24 00:47:51 UTC
And my jUnit module is:
impl: 200305260100
spec: 2.10.1

Sorry 'bout the multiple posts.
Comment 3 Marian Petras 2003-12-01 15:01:34 UTC
Confirmed.

I have reproduced the error under the following conditions:
 - action Create Test was invoked on a folder node
 - the folder node contained:
      - one runnable non-abstract class
      - one abstract class, which contained:
           - non-abstract method 'int compute()'
           - abstract method 'void hello()'

Method 'testCompute()' was broken as described above.
Comment 4 Marian Petras 2004-01-27 16:08:39 UTC
It will be fixed in NetBeans 3.6.
Comment 5 Marian Petras 2004-01-28 09:52:18 UTC
fixed in the trunk
Comment 6 Jiri Skrivanek 2004-01-30 09:24:45 UTC
Verified in build 200401291900.