public void _testCreateGroovyClass2GenericSuper() throws Exception { // FIXKDV: this test fails/crashes in Groovy. // cause: problems resolving generic types? IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null); NewClassWizardPage wizardPage = new NewClassWizardPage(); wizardPage.setPackageFragmentRoot(fSourceFolder, true); wizardPage.setPackageFragment(pack1, true); wizardPage.setEnclosingTypeSelection(false, true); wizardPage.setTypeName("E", true); wizardPage.setSuperClass("java.util.ArrayList<String>", true); List<String> interfaces = new ArrayList<String>(); wizardPage.setSuperInterfaces(interfaces, true); wizardPage.setMethodStubSelection(false, false, false, true); wizardPage.setAddComments(true, true); wizardPage.enableCommentControl(true); wizardPage.createType(null); String actual = wizardPage.getCreatedType().getCompilationUnit().getSource(); StringBuffer buf = new StringBuffer(); buf.append("/**\n"); buf.append(" * File\n"); buf.append(" */\n"); buf.append("package test1;\n"); buf.append("\n"); buf.append("import java.util.ArrayList;\n"); buf.append("\n"); buf.append("/**\n"); buf.append(" * Type\n"); buf.append(" */\n"); buf.append("class E extends ArrayList<String> {\n"); buf.append(" /* class body */\n"); buf.append("}\n"); String expected = buf.toString(); assertEqualLines(expected, actual); }
public void testCreateGroovyClass2() throws Exception { IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null); NewClassWizardPage wizardPage = new NewClassWizardPage(); wizardPage.setPackageFragmentRoot(fSourceFolder, true); wizardPage.setPackageFragment(pack1, true); wizardPage.setEnclosingTypeSelection(false, true); wizardPage.setTypeName("E", true); wizardPage.setSuperClass("ArrayList", true); List<String> interfaces = new ArrayList<String>(); wizardPage.setSuperInterfaces(interfaces, true); wizardPage.setMethodStubSelection(false, false, false, true); wizardPage.setAddComments(true, true); wizardPage.enableCommentControl(true); wizardPage.createType(new NullProgressMonitor()); String actual = wizardPage.getCreatedType().getCompilationUnit().getSource(); StringBuffer buf = new StringBuffer(); buf.append("/**\n"); buf.append(" * File\n"); buf.append(" */\n"); buf.append("package test1\n"); buf.append("\n"); buf.append("import java.util.ArrayList\n"); buf.append("\n"); buf.append("/**\n"); buf.append(" * Type\n"); buf.append(" */\n"); buf.append("class E extends ArrayList {\n"); buf.append(" /* class body */\n"); buf.append("}\n"); String expected = buf.toString(); assertEqualLines(expected, actual); }