From 4ecb38e8d47e7a30c80c1f67983b79dd81bbdcf3 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 2 May 2018 17:53:38 +0200 Subject: [PATCH] merge ExceptionFilterTest into ExceptionWorkerTest --- .../filters/ExceptionWorkerTest.java | 22 +++++++++ .../java/navigation/ExceptionFilterTest.java | 45 ------------------- 2 files changed, 22 insertions(+), 45 deletions(-) delete mode 100644 java/java-tests/testSrc/com/intellij/java/navigation/ExceptionFilterTest.java diff --git a/java/java-tests/testSrc/com/intellij/java/execution/filters/ExceptionWorkerTest.java b/java/java-tests/testSrc/com/intellij/java/execution/filters/ExceptionWorkerTest.java index 2f657c6cf335..6671010fc088 100644 --- a/java/java-tests/testSrc/com/intellij/java/execution/filters/ExceptionWorkerTest.java +++ b/java/java-tests/testSrc/com/intellij/java/execution/filters/ExceptionWorkerTest.java @@ -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")); + } } diff --git a/java/java-tests/testSrc/com/intellij/java/navigation/ExceptionFilterTest.java b/java/java-tests/testSrc/com/intellij/java/navigation/ExceptionFilterTest.java deleted file mode 100644 index 1983d2f1928b..000000000000 --- a/java/java-tests/testSrc/com/intellij/java/navigation/ExceptionFilterTest.java +++ /dev/null @@ -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()); - } -} \ No newline at end of file