if (newMethodsNames.contains(methodName.toString())) methodName.append("1");
if (newMethodsNames.contains(methodName.toString())) { int suffix= 1; while (newMethodsNames.contains(methodName.toString() + Integer.toString(suffix))) suffix++; methodName.append(Integer.toString(suffix)); }
	protected void createTestMethodStubs(IType type) throws JavaModelException {		IMethod[] methods= fPage2.getCheckedMethods();		if (methods.length > 0) {			/* find overloaded methods */			ArrayList allMethods= new ArrayList();			IMethod[] allMethodsArray= fPage2.getAllMethods();			for (int i= 0; i < allMethodsArray.length; i++) {				allMethods.add(allMethodsArray[i]);			}			ArrayList overloadedMethods= new ArrayList();			for (int i= 0; i < allMethods.size(); i++) {				IMethod current= (IMethod) allMethods.get(i);				String currentName= current.getElementName();				boolean currentAdded= false;				for (ListIterator iter= allMethods.listIterator(i+1); iter.hasNext(); ) {					IMethod iterMethod= (IMethod) iter.next();					if (iterMethod.getElementName().equals(currentName)) {						//method is overloaded						if (!currentAdded) {							overloadedMethods.add(current);							currentAdded= true;						}						overloadedMethods.add(iterMethod);						iter.remove();					}				}			}						/* used when for example both sum and Sum methods are present. Then			 * sum -> testSum			 * Sum -> testSum1			 */			ArrayList newMethodsNames= new ArrayList();							for (int i = 0; i < methods.length; i++) {				String elementName= methods[i].getElementName();				StringBuffer methodName= new StringBuffer(NewTestCaseCreationWizardPage2.PREFIX+Character.toUpperCase(elementName.charAt(0))+elementName.substring(1));				StringBuffer newMethod= new StringBuffer();					if (overloadedMethods.contains(methods[i])) {					IMethod method= methods[i];					newMethod.append("/*\n * Test for "+Signature.toString(method.getReturnType())+" "+method.getElementName()+"("); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$					String[] paramTypes= method.getParameterTypes();					if (paramTypes.length > 0) {						if (paramTypes.length > 1) {							for (int j= 0; j < paramTypes.length-1; j++) {								newMethod.append(Signature.toString(paramTypes[j])+", "); //$NON-NLS-1$							}						}						newMethod.append(Signature.toString(paramTypes[paramTypes.length-1]));					}					newMethod.append(")\n */\n"); //$NON-NLS-1$					String[] params= methods[i].getParameterTypes();					for (int j= 0; j < params.length; j++) {						String param= params[j];						int start= 0, end= param.length();						//using JDK 1.4:						// (new Character(Signature.C_ARRAY)).toString() --> Character.toString(Signature.C_ARRAY)						if (param.startsWith( (new Character(Signature.C_ARRAY)).toString() ))							start= 1;												if (param.endsWith((new Character(Signature.C_NAME_END)).toString() ))							end--;												if (param.startsWith((new Character(Signature.C_UNRESOLVED)).toString() ,start)							|| param.startsWith((new Character(Signature.C_RESOLVED)).toString() ,start))							start++;						String paramName= param.substring(start, end);						/* if parameter is qualified name, extract simple name */						if (paramName.indexOf('.') != -1) {							start += paramName.lastIndexOf('.')+1;						}						methodName.append(param.substring(start, end));						if (param.startsWith( (new Character(Signature.C_ARRAY)).toString() ))							methodName.append("Array"); //$NON-NLS-1$					}				}								if (newMethodsNames.contains(methodName.toString()))					methodName.append("1"); //$NON-NLS-1$				newMethodsNames.add(new String(methodName));				newMethod.append("public void "+methodName.toString()+"() {}\n\n"); //$NON-NLS-1$ //$NON-NLS-2$				type.createMethod(newMethod.toString(), null, false, null);				}		}	}