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
if (superTypes[i].exists()) {
					IMethod constrMethod= superTypes[i].getMethod(superTypes[i].getElementName(), new String[] {"Ljava.lang.String;"}); 
					if (constrMethod.exists() && constrMethod.isConstructor()) {
						methodTemplate= constrMethod;
						break;
					}
				}
			}
		}
		CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
		if (methodTemplate != null) {
			GenStubSettings genStubSettings= new GenStubSettings(settings);
			genStubSettings.fCallSuper= true;				
			genStubSettings.fMethodOverwrites= true;
			constr= JUnitStubUtility.genStub(getTypeName(), methodTemplate, genStubSettings, imports);
		} else {
			constr += "public "+getTypeName()+"(String name) {\nsuper(name);\n}\n\n"; 
		}
		type.createMethod(constr, null, true, null);	
		fIndexOfFirstTestMethod++;
	}
	protected void createMain(IType type) throws JavaModelException {
		type.createMethod(fMethodStubsButtons.getMainMethod(getTypeName()), null, false, null);	
		fIndexOfFirstTestMethod++;		
	}
	protected void createSetUp(IType type, ImportsManager imports) throws JavaModelException {
		ITypeHierarchy typeHierarchy= null;
		IType[] superTypes= null;
		String setUp= ""; 
		IMethod methodTemplate= null;