merge ExceptionFilterTest into ExceptionWorkerTest

This commit is contained in:
peter
2018-05-02 18:23:06 +02:00
parent 90877751c9
commit 4ecb38e8d4
2 changed files with 22 additions and 45 deletions
@@ -16,11 +16,13 @@
package com.intellij.java.execution.filters;
import com.intellij.execution.filters.ExceptionExFilterFactory;
import com.intellij.execution.filters.ExceptionInfoCache;
import com.intellij.execution.filters.ExceptionWorker;
import com.intellij.execution.filters.FilterMixin;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
@@ -103,4 +105,24 @@ public class ExceptionWorkerTest extends LightCodeInsightFixtureTestCase {
"java.lang.ref.ReferenceQueue", "remove", null, 143);
}
public void testJava9ModulePrefixed() {
String line = "at mod.name/p.A.foo(A.java:2)\n";
assertParsed(line, "p.A", "foo", "A.java", 2);
PsiClass psiClass = myFixture.addClass("package p; public class A {\n" +
" public void foo() {}\n" +
"}");
ExceptionWorker worker = new ExceptionWorker(new ExceptionInfoCache(GlobalSearchScope.projectScope(getProject())));
worker.execute(line, line.length());
PsiClass aClass = worker.getPsiClass();
assertNotNull(aClass);
assertEquals(psiClass, aClass);
}
public void testNonClassInTheLine() {
String line = "2016-12-20 10:58:36,617 [ 5740] INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: Android Support (10.2.2), Ant Support (1.0), Application Servers View (0.2.0), AspectJ Support (1.2), CFML Support (3.53), CSS Support (163.7743.44), CVS Integration (11), Cloud Foundry integration (1.0), CloudBees integration (1.0), Copyright (8.1), Coverage (163.7743.44), DSM Analysis (1.0.0), Database Tools and SQL (1.0), Eclipse Integration (3.0), EditorConfig (163.7743.44), Emma (163.7743.44), Flash/Flex Support (163.7743.44)";
assertNull(ExceptionWorker.parseExceptionLine(line));
assertNull(ExceptionWorker.parseExceptionLine(line + "\n"));
}
}
@@ -1,45 +0,0 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.navigation;
import com.intellij.execution.filters.ExceptionInfoCache;
import com.intellij.execution.filters.ExceptionWorker;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
public class ExceptionFilterTest extends JavaCodeInsightFixtureTestCase {
public void testJava9ModulePrefixed() {
PsiClass psiClass = myFixture.addClass("package p; public class A {\n" +
" public void foo() {}\n" +
"}");
ExceptionWorker worker = new ExceptionWorker(new ExceptionInfoCache(GlobalSearchScope.projectScope(getProject())));
String line = "at mod.name/p.A.foo(A.java:2)";
worker.execute(line, line.length());
PsiClass aClass = worker.getPsiClass();
assertNotNull(aClass);
assertEquals(psiClass, aClass);
}
public void testNonClassInTheLine() {
ExceptionWorker worker = new ExceptionWorker(new ExceptionInfoCache(GlobalSearchScope.allScope(getProject())));
String line = "2016-12-20 10:58:36,617 [ 5740] INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: Android Support (10.2.2), Ant Support (1.0), Application Servers View (0.2.0), AspectJ Support (1.2), CFML Support (3.53), CSS Support (163.7743.44), CVS Integration (11), Cloud Foundry integration (1.0), CloudBees integration (1.0), Copyright (8.1), Coverage (163.7743.44), DSM Analysis (1.0.0), Database Tools and SQL (1.0), Eclipse Integration (3.0), EditorConfig (163.7743.44), Emma (163.7743.44), Flash/Flex Support (163.7743.44)";
worker.execute(line, line.length());
assertNull(worker.getPsiClass());
}
}