Files
openide/plugins/performanceTesting/testSrc/com/jetbrains/performancePlugin/RunClassInPluginCommandTest.java
Maxim.Kolmakov 1196257bd0 AT-126 Open-source performance plugin
Split performance plugin into core (and move it to community), async and YK. Move Cache Value Profiler to separate plugin.

GitOrigin-RevId: 80e68080197e86d40c76be45d5438ec0eee39818
2022-10-26 13:08:49 +00:00

49 lines
1.4 KiB
Java

package com.jetbrains.performancePlugin;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.project.Project;
import com.intellij.testFramework.HeavyPlatformTestCase;
import com.jetbrains.performancePlugin.commands.RunClassInPlugin;
import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
public class RunClassInPluginCommandTest extends HeavyPlatformTestCase {
public void test_execute_script_in_classpath1() throws Exception {
doTest(TestClass1.class);
}
public void test_execute_script_in_classpath2() throws Exception {
doTest(TestClass2.class);
}
private void doTest(@NotNull Class<?> test) throws Exception {
System.setProperty(test.getName(), "not set");
String line = RunClassInPlugin.PREFIX +
" com.intellij " +
test.getName() +
" method123 \"" +
PathManager.getJarPathForClass(test) +
"\"";
new RunClassInPlugin(line, 123).computePromise(getProject());
Assert.assertEquals("123", System.getProperty(test.getName()));
}
public static class TestClass1 {
@SuppressWarnings("unused")
public void method123(@NotNull Project project) {
System.setProperty(getClass().getName(), "123");
}
}
public static class TestClass2 {
@SuppressWarnings("unused")
public void method123() {
System.setProperty(getClass().getName(), "123");
}
}
}