Bug 25014 JUnit TestCase Wizard accepts empty string as test case name[junit]
Version: 2.0 Build id: 200210161553 The JUnit TestCase wizard accepts empty string as the test case name when there is no Java class currently selected. Steps for reproducing the error: 1 - Ensure there is no class currently selected in the Package Explorer (e.g. select a package or project); 2 - Activate New JUnit TestCase wizard; 3 - There will be no test case name selected. The "Finish" button will be disabled. Then erase the "Superclass" field content. The "Finish" button will be enabled. This opens a dialog with a message "Creation of element failed. Reason: Invalid name specified: .java" and a new entry is added to the error log. The stack trace will be attached.
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/NewTestCaseCreationWizardPage.java
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.SelectionDialog;
import org.eclipse.ui.help.WorkbenchHelp;
/**
 * The first page of the TestCase creation wizard. 
 */
public class NewTestCaseCreationWizardPage extends NewTypeWizardPage {
	protected final static String PAGE_NAME= "NewTestCaseCreationWizardPage"; 
	protected final static String CLASS_TO_TEST= PAGE_NAME + ".classtotest"; 
	protected final static String TEST_CLASS= PAGE_NAME + ".testclass"; 
	protected final static String TEST_SUFFIX= "Test"; 
	protected final static String SETUP= "setUp"; 
	protected final static String TEARDOWN= "tearDown"; 
	protected final static String STORE_GENERATE_MAIN= PAGE_NAME + ".GENERATE_MAIN"; 
	protected final static String STORE_USE_TESTRUNNER= PAGE_NAME + ".USE_TESTRUNNER";	
	protected final static String STORE_TESTRUNNER_TYPE= PAGE_NAME + ".TESTRUNNER_TYPE"; 
	
	private String fDefaultClassToTest;