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 157410 - Make it possible to do TDD by offering to create methods that don't exist when inside of JUnit assert statements
Summary: Make it possible to do TDD by offering to create methods that don't exist whe...
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: All All
: P2 blocker with 5 votes (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2009-01-25 17:00 UTC by rdelaplante
Modified: 2015-03-03 06:47 UTC (History)
2 users (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description rdelaplante 2009-01-25 17:00:22 UTC
For example:

package tdd1.template;

import org.junit.Test;
import static org.junit.Assert.*;

public class TestTemplate {
    public void oneVariable() throws Exception {
        Template template = new Template("Hello, ${name}");
        template.set("name", "Reader");
        assertEquals("Hello, Reader", template.evaluate());

* NetBeans offered to create class Template with a String parameter in the constructor (great!), but it created it in
the Test Classes tree instead of the Source Classes tree. Now I have to manually move the class. 
* NetBeans offered to create a set method in the Template class with two String parameters (great!)

On the third line, NetBeans displays a red error underline below the assertEquals method call, and below the
template.evaluate() part because it doesn't exist.  Because template.evaluate() doesn't exist, it doesn't know the
return type, and therefore can't find a static method signature in org.junit.Assert that matches.  No hints from NetBeans.

When I move template.evaluate() onto it's own line, NetBeans offers to create the method in the Template class.  It
creates it with a void return type.  Now I have to go into Template class and change the return type to String, then
move the template.evaluate() line in my test back into the assertEquals line.
Comment 1 jbarroso 2011-12-25 12:49:27 UTC
Also happens in 7.0.1 version
Comment 2 Mahene 2013-04-15 15:27:14 UTC
Feature is still missing in the nightly builds.
TDD is very inconvenient with this inconsistency.
Comment 3 rjdkolb 2015-03-03 06:47:34 UTC
Was there any development on this ?

I missed this issue when I logged a similar one (oops) :