fix compilation after: remove unused dependency on Mocks lib

fix installer (some production code depends on testframework)
This commit is contained in:
Vladimir Krivosheev
2015-08-21 19:11:44 +02:00
parent 4c7ea6ca38
commit 3b10c1f832
13 changed files with 60 additions and 52 deletions
+1
View File
@@ -45,5 +45,6 @@
<orderEntry type="module" module-name="RegExpSupport" scope="TEST" />
<orderEntry type="module" module-name="spellchecker" scope="TEST" />
<orderEntry type="module" module-name="util-tests" scope="TEST" />
<orderEntry type="library" name="Mocks" level="project" />
</component>
</module>
+1
View File
@@ -30,5 +30,6 @@
<orderEntry type="module" module-name="structure-view-impl" exported="" />
<orderEntry type="library" name="commons-logging" level="project" />
<orderEntry type="module" module-name="testFramework" scope="TEST" />
<orderEntry type="library" name="Mocks" level="project" />
</component>
</module>
+2 -2
View File
@@ -15,6 +15,6 @@
<orderEntry type="library" exported="" name="tcServiceMessages" level="project" />
<orderEntry type="module" module-name="annotations" />
<orderEntry type="module" module-name="testFramework" scope="TEST" />
<orderEntry type="library" name="Mocks" level="project" />
</component>
</module>
</module>
@@ -19,7 +19,7 @@ import com.intellij.execution.testframework.Filter;
import com.intellij.execution.testframework.TestConsoleProperties;
import com.intellij.execution.testframework.sm.runner.ui.MockPrinter;
import com.intellij.psi.search.GlobalSearchScope;
import org.easymock.classextension.EasyMock;
import org.easymock.EasyMock;
import static com.intellij.execution.testframework.sm.runner.states.TestStateInfo.Magnitude;
@@ -0,0 +1,46 @@
/*
* Copyright 2000-2015 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.testFramework
import com.intellij.util.ThrowableRunnable
import java.lang.reflect.InvocationTargetException
import javax.swing.SwingUtilities
import kotlin.platform.platformStatic
class EdtTestUtil {
companion object {
public platformStatic fun runInEdtAndWait(runnable: ThrowableRunnable<Throwable>) {
runInEdtAndWait({ runnable.run() })
}
// Test only because in production you must use Application.invokeAndWait(Runnable, ModalityState).
// The problem is - Application logs errors, but not throws. But in tests must be thrown.
// In any case name "runInEdtAndWait" is better than "invokeAndWait".
public platformStatic fun runInEdtAndWait(runnable: () -> Unit) {
if (SwingUtilities.isEventDispatchThread()) {
runnable()
}
else {
try {
SwingUtilities.invokeAndWait(runnable)
}
catch (e: InvocationTargetException) {
throw e.getCause() ?: e
}
}
}
}
}
@@ -592,7 +592,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
}
TestRunnerUtil.replaceIdeEventQueueSafely();
TestFrameworkPackage.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
@Override
public void run() throws Throwable {
try {
@@ -18,7 +18,6 @@ package com.intellij.testFramework;
import com.intellij.ide.IdeEventQueue;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,7 +25,6 @@ import sun.awt.AWTAutoShutdown;
import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -74,23 +72,4 @@ public class TestRunnerUtil {
throw new RuntimeException(e);
}
}
// Test only because in production you must use Application.invokeAndWait(Runnable, ModalityState).
// The problem is - Application logs errors, but not throws. But in tests must be thrown.
// In any case name "runInEdtAndWait" is better than "invokeAndWait".
public static void runInEdtAndWait(@NotNull Runnable runnable) throws Throwable {
replaceIdeEventQueueSafely();
if (SwingUtilities.isEventDispatchThread()) {
runnable.run();
}
else {
try {
SwingUtilities.invokeAndWait(runnable);
}
catch (InvocationTargetException e) {
Throwable cause = e.getCause();
throw cause == null ? e : cause;
}
}
}
}
@@ -416,7 +416,7 @@ public abstract class UsefulTestCase extends TestCase {
if (runInDispatchThread()) {
TestRunnerUtil.replaceIdeEventQueueSafely();
TestFrameworkPackage.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
@Override
public void run() throws Throwable {
defaultRunBare();
@@ -1372,7 +1372,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
super.setUp();
TestRunnerUtil.replaceIdeEventQueueSafely();
TestFrameworkPackage.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
@Override
public void run() throws Throwable {
myProjectFixture.setUp();
@@ -1536,7 +1536,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
private PsiFile configureInner(@NotNull final VirtualFile copy, @NotNull final SelectionAndCaretMarkupLoader loader) {
assertInitialized();
TestFrameworkPackage.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
@Override
public void run() {
if (!copy.getFileType().isBinary()) {
@@ -36,7 +36,6 @@ import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory
import com.intellij.util.SmartList
import com.intellij.util.ThrowableRunnable
import com.intellij.util.lang.CompoundRuntimeException
import org.junit.rules.ExternalResource
import org.junit.rules.TestRule
@@ -48,9 +47,7 @@ import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target
import java.lang.reflect.InvocationTargetException
import java.util.concurrent.atomic.AtomicBoolean
import javax.swing.SwingUtilities
/**
* Project created on request, so, could be used as a bare (only application).
@@ -147,6 +144,10 @@ public class ProjectRule() : ExternalResource() {
}
}
public fun runInEdtAndWait(runnable: () -> Unit) {
EdtTestUtil.runInEdtAndWait(runnable)
}
public open class FixtureRule() : ExternalResource() {
companion object {
init {
@@ -197,27 +198,6 @@ public class RuleChain(vararg val rules: TestRule) : TestRule {
}
}
public fun runInEdtAndWait(runnable: ThrowableRunnable<Throwable>) {
runInEdtAndWait({ runnable.run() })
}
// Test only because in production you must use Application.invokeAndWait(Runnable, ModalityState).
// The problem is - Application logs errors, but not throws. But in tests must be thrown.
// In any case name "runInEdtAndWait" is better than "invokeAndWait".
public fun runInEdtAndWait(runnable: () -> Unit) {
if (SwingUtilities.isEventDispatchThread()) {
runnable()
}
else {
try {
SwingUtilities.invokeAndWait(runnable)
}
catch (e: InvocationTargetException) {
throw e.getCause() ?: e
}
}
}
private fun <T : Annotation> Description.getOwnOrClassAnnotation(annotationClass: Class<T>) = getAnnotation(annotationClass) ?: getTestClass()?.getAnnotation(annotationClass)
@Retention(RetentionPolicy.RUNTIME)
@@ -20,5 +20,6 @@
<orderEntry type="module" module-name="python-pydev" scope="TEST" />
<orderEntry type="module" module-name="smRunner" scope="TEST" />
<orderEntry type="library" scope="TEST" name="mockito" level="project" />
<orderEntry type="library" name="Mocks" level="project" />
</component>
</module>