void () { ModifiableModuleModel model = ModuleManager.getInstance(getProject()).getModifiableModel(); model.disposeModule(getModule()); WriteCommandAction.runWriteCommandAction(getProject(), () -> model.commit()); ScratchFileCreationHelper.Context context = new ScratchFileCreationHelper.Context(); context.language = JavaLanguage.INSTANCE; PsiFile file = ScratchFileActions.doCreateNewScratch(getProject(), context); assertInstanceOf(file, PsiJavaFile.class); PsiClass[] classes = ((PsiJavaFile)file).getClasses(); assertEquals(1, classes.length); PsiMethod[] methods = classes[0].getMethods(); assertEquals(1, methods.length); PsiParameterList parameterList = methods[0].getParameterList(); assertEquals(1, parameterList.getParametersCount()); PsiType type = parameterList.getParameter(0).getType(); assertInstanceOf(type, PsiArrayType.class); type = ((PsiArrayType)type).getComponentType(); assertInstanceOf(type, PsiClassType.class); PsiClass stringClass = ((PsiClassType)type).resolve(); assertNotNull(stringClass); assertEquals(CommonClassNames.JAVA_LANG_STRING, stringClass.getQualifiedName()); }