Search in sources :

Example 1 with Bombed

use of com.intellij.idea.Bombed in project intellij-community by JetBrains.

the class InvalidProjectImportingTest method testUnresolvedPlugins.

@Bombed(user = "Vladislav.Soroka", year = 2020, month = Calendar.APRIL, day = 1, description = "temporary disabled")
public void testUnresolvedPlugins() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <plugins>" + "   <plugin>" + "     <groupId>xxx</groupId>" + "     <artifactId>yyy</artifactId>" + "     <version>1</version>" + "    </plugin>" + "  </plugins>" + "</build>");
    MavenProject root = getRootProjects().get(0);
    assertProblems(root, "Unresolved plugin: 'xxx:yyy:1'");
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) Bombed(com.intellij.idea.Bombed)

Example 2 with Bombed

use of com.intellij.idea.Bombed in project intellij-community by JetBrains.

the class InvalidProjectImportingTest method testUnresolvedExtensionsAfterResolve.

@Bombed(user = "Vladislav.Soroka", year = 2020, month = Calendar.APRIL, day = 1, description = "temporary disabled")
public void testUnresolvedExtensionsAfterResolve() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <extensions>" + "   <extension>" + "     <groupId>xxx</groupId>" + "     <artifactId>yyy</artifactId>" + "     <version>1</version>" + "    </extension>" + "  </extensions>" + "</build>");
    resolveDependenciesAndImport();
    MavenProject root = getRootProjects().get(0);
    assertProblems(root, "Unresolved build extension: 'xxx:yyy:1'");
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) Bombed(com.intellij.idea.Bombed)

Example 3 with Bombed

use of com.intellij.idea.Bombed in project intellij-community by JetBrains.

the class InvalidProjectImportingTest method testUnresolvedPomTypeDependency.

@Bombed(user = "Vladislav.Soroka", year = 2020, month = Calendar.APRIL, day = 1, description = "temporary disabled")
public void testUnresolvedPomTypeDependency() throws Exception {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + "  <dependency>" + "    <groupId>xxx</groupId>" + "    <artifactId>yyy</artifactId>" + "    <version>4.0</version>" + "    <type>pom</type>" + "  </dependency>" + "</dependencies>");
    importProject();
    assertModuleLibDeps("project");
    MavenProject root = getRootProjects().get(0);
    assertProblems(root, "Unresolved dependency: 'xxx:yyy:pom:4.0'");
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) Bombed(com.intellij.idea.Bombed)

Example 4 with Bombed

use of com.intellij.idea.Bombed in project intellij-community by JetBrains.

the class InvalidProjectImportingTest method testUnresolvedPluginsAsExtensions.

@Bombed(user = "Vladislav.Soroka", year = 2020, month = Calendar.APRIL, day = 1, description = "temporary disabled")
public void testUnresolvedPluginsAsExtensions() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <plugins>" + "   <plugin>" + "     <groupId>xxx</groupId>" + "     <artifactId>yyy</artifactId>" + "     <version>1</version>" + "     <extensions>true</extensions>" + "    </plugin>" + "  </plugins>" + "</build>");
    assertModules("project");
    MavenProject root = getRootProjects().get(0);
    assertProblems(root, "Unresolved plugin: 'xxx:yyy:1'");
}
Also used : MavenProject(org.jetbrains.idea.maven.project.MavenProject) Bombed(com.intellij.idea.Bombed)

Example 5 with Bombed

use of com.intellij.idea.Bombed in project intellij-community by JetBrains.

the class TestAll method getTest.

@Nullable
private static Test getTest(@NotNull final Class<?> testCaseClass) {
    try {
        if ((testCaseClass.getModifiers() & Modifier.PUBLIC) == 0) {
            return null;
        }
        Bombed classBomb = testCaseClass.getAnnotation(Bombed.class);
        if (classBomb != null && PlatformTestUtil.bombExplodes(classBomb)) {
            return new ExplodedBomb(testCaseClass.getName(), classBomb);
        }
        Method suiteMethod = safeFindMethod(testCaseClass, "suite");
        if (suiteMethod != null && !isPerformanceTestsRun()) {
            return (Test) suiteMethod.invoke(null, ArrayUtil.EMPTY_CLASS_ARRAY);
        }
        if (TestRunnerUtil.isJUnit4TestClass(testCaseClass)) {
            JUnit4TestAdapter adapter = new JUnit4TestAdapter(testCaseClass);
            boolean runEverything = isIncludingPerformanceTestsRun() || isPerformanceTest(null, testCaseClass) && isPerformanceTestsRun();
            if (!runEverything) {
                try {
                    adapter.filter(isPerformanceTestsRun() ? PERFORMANCE_ONLY : NO_PERFORMANCE);
                } catch (NoTestsRemainException ignored) {
                }
            }
            return adapter;
        }
        final int[] testsCount = { 0 };
        TestSuite suite = new TestSuite(testCaseClass) {

            @Override
            public void addTest(Test test) {
                if (!(test instanceof TestCase)) {
                    doAddTest(test);
                } else {
                    String name = ((TestCase) test).getName();
                    // Mute TestSuite's "no tests found" warning
                    if ("warning".equals(name))
                        return;
                    if (!isIncludingPerformanceTestsRun() && (isPerformanceTestsRun() ^ isPerformanceTest(name, testCaseClass)))
                        return;
                    Method method = findTestMethod((TestCase) test);
                    if (method == null) {
                        doAddTest(test);
                    } else {
                        Bombed methodBomb = method.getAnnotation(Bombed.class);
                        if (methodBomb == null) {
                            doAddTest(test);
                        } else if (PlatformTestUtil.bombExplodes(methodBomb)) {
                            doAddTest(new ExplodedBomb(method.getDeclaringClass().getName() + "." + method.getName(), methodBomb));
                        }
                    }
                }
            }

            private void doAddTest(Test test) {
                testsCount[0]++;
                super.addTest(test);
            }

            @Nullable
            private Method findTestMethod(final TestCase testCase) {
                return safeFindMethod(testCase.getClass(), testCase.getName());
            }
        };
        return testsCount[0] > 0 ? suite : null;
    } catch (Throwable t) {
        System.err.println("Failed to load test: " + testCaseClass.getName());
        t.printStackTrace(System.err);
        return null;
    }
}
Also used : NoTestsRemainException(org.junit.runner.manipulation.NoTestsRemainException) Method(java.lang.reflect.Method) Bombed(com.intellij.idea.Bombed) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Bombed (com.intellij.idea.Bombed)9 MavenProject (org.jetbrains.idea.maven.project.MavenProject)8 Method (java.lang.reflect.Method)1 Nullable (org.jetbrains.annotations.Nullable)1 NoTestsRemainException (org.junit.runner.manipulation.NoTestsRemainException)1