Search in sources :

Example 1 with TestRunLineMarkerProvider

use of com.intellij.testIntegration.TestRunLineMarkerProvider in project intellij-community by JetBrains.

the class RunLineMarkerTest method testNestedTestClass.

public void testNestedTestClass() throws Exception {
    TestStateStorage stateStorage = TestStateStorage.getInstance(getProject());
    String testUrl = "java:suite://Main$MainTest";
    try {
        stateStorage.writeState(testUrl, new TestStateStorage.Record(TestStateInfo.Magnitude.FAILED_INDEX.getValue(), new Date(), 0));
        myFixture.addClass("package junit.framework; public class TestCase {}");
        PsiFile file = myFixture.configureByText("MainTest.java", "public class Main {\n" + "  public class Main<caret>Test extends junit.framework.TestCase {\n" + "    public void testFoo() {\n" + "    }\n" + "  }" + "}");
        RunLineMarkerContributor.Info info = new TestRunLineMarkerProvider().getInfo(file.findElementAt(myFixture.getCaretOffset()));
        assertNotNull(info);
        assertEquals(AllIcons.RunConfigurations.TestState.Red2, info.icon);
    } finally {
        stateStorage.removeState(testUrl);
    }
}
Also used : TestStateStorage(com.intellij.execution.TestStateStorage) RunLineMarkerContributor(com.intellij.execution.lineMarker.RunLineMarkerContributor) TestRunLineMarkerProvider(com.intellij.testIntegration.TestRunLineMarkerProvider) PsiFile(com.intellij.psi.PsiFile) Date(java.util.Date)

Aggregations

TestStateStorage (com.intellij.execution.TestStateStorage)1 RunLineMarkerContributor (com.intellij.execution.lineMarker.RunLineMarkerContributor)1 PsiFile (com.intellij.psi.PsiFile)1 TestRunLineMarkerProvider (com.intellij.testIntegration.TestRunLineMarkerProvider)1 Date (java.util.Date)1