Search in sources :

Example 41 with Ignore

use of org.junit.Ignore in project che by eclipse.

the class ModifierCorrectionsQuickFixTest method testSuppressNLSWarningAnnotation4.

@Test
@Ignore
public void testSuppressNLSWarningAnnotation4() throws Exception {
    Hashtable options = JavaCore.getOptions();
    options.put(JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL, JavaCore.WARNING);
    JavaCore.setOptions(options);
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1; \n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        @SuppressWarnings(\"unused\") String s = \"\";\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot);
    assertNumberOfProposals(proposals, 4);
    assertCorrectLabels(proposals);
    String[] expected = new String[2];
    buf = new StringBuffer();
    buf.append("package test1; \n");
    buf.append("public class E {\n");
    buf.append("    public void foo() {\n");
    buf.append("        @SuppressWarnings({\"unused\", \"nls\"}) String s = \"\";\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[0] = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1; \n");
    buf.append("public class E {\n");
    buf.append("    @SuppressWarnings(\"nls\")\n");
    buf.append("    public void foo() {\n");
    buf.append("        @SuppressWarnings(\"unused\") String s = \"\";\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[1] = buf.toString();
    assertExpectedExistInProposals(proposals, expected);
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 42 with Ignore

use of org.junit.Ignore in project che by eclipse.

the class UnresolvedTypesQuickFixTest method testInnerType.

@Test
@Ignore
public void testInnerType() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    void foo() {\n");
    buf.append("        Object object= new F.Inner() {\n");
    buf.append("        };\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu1 = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class F {\n");
    buf.append("}\n");
    pack1.createCompilationUnit("F.java", buf.toString(), false, null);
    CompilationUnit astRoot = getASTRoot(cu1);
    ArrayList proposals = collectCorrections(cu1, astRoot);
    assertCorrectLabels(proposals);
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    void foo() {\n");
    buf.append("        Object object= new Object() {\n");
    buf.append("        };\n");
    buf.append("    }\n");
    buf.append("}\n");
    String expected1 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class F {\n");
    buf.append("\n");
    buf.append("    public class Inner {\n");
    buf.append("\n");
    buf.append("    }\n");
    buf.append("}\n");
    String expected2 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class F {\n");
    buf.append("\n");
    buf.append("    public interface Inner {\n");
    buf.append("\n");
    buf.append("    }\n");
    buf.append("}\n");
    String expected3 = buf.toString();
    assertExpectedExistInProposals(proposals, new String[] { expected1, expected2, expected3 });
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) ArrayList(java.util.ArrayList) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 43 with Ignore

use of org.junit.Ignore in project che by eclipse.

the class UnresolvedTypesQuickFixTest method testPrimitiveTypeInFieldDecl.

@Test
@Ignore
public void testPrimitiveTypeInFieldDecl() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    floot vec= 1.0;\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot);
    assertCorrectLabels(proposals);
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    double vec= 1.0;\n");
    buf.append("}\n");
    String expected1 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    Float vec= 1.0;\n");
    buf.append("}\n");
    String expected2 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E {\n");
    buf.append("    float vec= 1.0;\n");
    buf.append("}\n");
    String expected3 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("\n");
    buf.append("public class floot {\n");
    buf.append("\n");
    buf.append("}\n");
    String expected4 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("\n");
    buf.append("public interface floot {\n");
    buf.append("\n");
    buf.append("}\n");
    String expected5 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("\n");
    buf.append("public enum floot {\n");
    buf.append("\n");
    buf.append("}\n");
    String expected6 = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("public class E<floot> {\n");
    buf.append("    floot vec= 1.0;\n");
    buf.append("}\n");
    String expected7 = buf.toString();
    assertExpectedExistInProposals(proposals, new String[] { expected1, expected2, expected3, expected4, expected5, expected6, expected7 });
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) ArrayList(java.util.ArrayList) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 44 with Ignore

use of org.junit.Ignore in project che by eclipse.

the class UnresolvedTypesQuickFixTest method testAmbiguousTypeInInterface.

@Test
@Ignore
public void testAmbiguousTypeInInterface() throws Exception {
    createSomeAmbiguity(true, false);
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import test2.*;\n");
    buf.append("import test3.*;\n");
    buf.append("public class E implements A {\n");
    buf.append("    B b;\n");
    buf.append("    C c;\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot);
    assertNumberOfProposals(proposals, 2);
    assertCorrectLabels(proposals);
    CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
    String preview1 = getPreviewContent(proposal);
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import test2.*;\n");
    buf.append("import test2.A;\n");
    buf.append("import test3.*;\n");
    buf.append("public class E implements A {\n");
    buf.append("    B b;\n");
    buf.append("    C c;\n");
    buf.append("}\n");
    String expected1 = buf.toString();
    proposal = (CUCorrectionProposal) proposals.get(1);
    String preview2 = getPreviewContent(proposal);
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import test2.*;\n");
    buf.append("import test3.*;\n");
    buf.append("import test3.A;\n");
    buf.append("public class E implements A {\n");
    buf.append("    B b;\n");
    buf.append("    C c;\n");
    buf.append("}\n");
    String expected2 = buf.toString();
    assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) CUCorrectionProposal(org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal) ArrayList(java.util.ArrayList) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 45 with Ignore

use of org.junit.Ignore in project che by eclipse.

the class UnresolvedTypesQuickFixTest method testTypeInTypeArguments2.

@Test
@Ignore
public void testTypeInTypeArguments2() throws Exception {
    IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
    StringBuffer buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Map;\n");
    buf.append("public class E<T> {\n");
    buf.append("    static class SomeType { }\n");
    buf.append("    void foo() {\n");
    buf.append("        E<Map<String, ? extends XYX>> list= new E<Map<String, ? extends SomeType>>() {\n");
    buf.append("        };\n");
    buf.append("    }\n");
    buf.append("}\n");
    ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
    CompilationUnit astRoot = getASTRoot(cu);
    ArrayList proposals = collectCorrections(cu, astRoot);
    assertCorrectLabels(proposals);
    String[] expected = new String[6];
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Map;\n");
    buf.append("public class E<T> {\n");
    buf.append("    static class SomeType { }\n");
    buf.append("    void foo() {\n");
    buf.append("        E<Map<String, ? extends SomeType>> list= new E<Map<String, ? extends SomeType>>() {\n");
    buf.append("        };\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[0] = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("\n");
    buf.append("import test1.E.SomeType;\n");
    buf.append("\n");
    buf.append("public class XYX extends SomeType {\n");
    buf.append("\n");
    buf.append("}\n");
    expected[1] = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("\n");
    buf.append("public interface XYX {\n");
    buf.append("\n");
    buf.append("}\n");
    expected[2] = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("\n");
    buf.append("public enum XYX {\n");
    buf.append("\n");
    buf.append("}\n");
    expected[3] = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Map;\n");
    buf.append("public class E<T> {\n");
    buf.append("    static class SomeType { }\n");
    buf.append("    <XYX> void foo() {\n");
    buf.append("        E<Map<String, ? extends XYX>> list= new E<Map<String, ? extends SomeType>>() {\n");
    buf.append("        };\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[4] = buf.toString();
    buf = new StringBuffer();
    buf.append("package test1;\n");
    buf.append("import java.util.Map;\n");
    buf.append("public class E<T, XYX> {\n");
    buf.append("    static class SomeType { }\n");
    buf.append("    void foo() {\n");
    buf.append("        E<Map<String, ? extends XYX>> list= new E<Map<String, ? extends SomeType>>() {\n");
    buf.append("        };\n");
    buf.append("    }\n");
    buf.append("}\n");
    expected[5] = buf.toString();
    assertExpectedExistInProposals(proposals, expected);
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) CompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) ArrayList(java.util.ArrayList) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Ignore (org.junit.Ignore)5092 Test (org.junit.Test)4807 File (java.io.File)445 ArrayList (java.util.ArrayList)374 IOException (java.io.IOException)217 HashMap (java.util.HashMap)187 List (java.util.List)171 CountDownLatch (java.util.concurrent.CountDownLatch)118 Map (java.util.Map)103 LocalDate (java.time.LocalDate)94 Dataset (org.apache.jena.query.Dataset)93 InputStream (java.io.InputStream)89 Date (java.util.Date)88 Random (java.util.Random)85 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)83 Properties (java.util.Properties)78 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)78 HashSet (java.util.HashSet)71 ByteArrayOutputStream (java.io.ByteArrayOutputStream)70 ExecutorService (java.util.concurrent.ExecutorService)70