дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-26 11:18:20 +02:00
feat(run): run JUnit 4 tests from the gutter without Maven (#5949)
Running a JUnit 4 test from the gutter of a Maven module started mvn test, so the Run console showed the whole Maven and Surefire log. OpenIDEA's JUnit runner now runs JUnit 4 and JUnit 3 tests on JUnit 4's own JUnitCore when the classpath has no JUnit Platform (or one without the Vintage engine); JUnit 5 keeps the Platform launcher. The Run console of JVM test runs also shows each test's stdout/stderr and failure trace, which the runner and the Gradle init script report only through service messages. Fixes #5765
Цей коміт міститься в:
1 джерело
cdff357fdd
коміт
edc750174b
20 files changed
+657
-210
No files matched your search
@@ -0,0 +1,65 @@
|
||||
package sample;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
public class Junit4SampleTest {
|
||||
@Test
|
||||
public void passes() {
|
||||
System.out.println("hello [ünï]");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fails() {
|
||||
assertEquals("it's wrong", 1, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("later")
|
||||
public void ignored() {}
|
||||
|
||||
@Test
|
||||
public void assumed() {
|
||||
assumeTrue(false);
|
||||
}
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public static class Params {
|
||||
@Parameterized.Parameters
|
||||
public static Collection<Object[]> data() {
|
||||
return Arrays.asList(new Object[][] {{1}, {2}});
|
||||
}
|
||||
|
||||
private final int n;
|
||||
|
||||
public Params(int n) {
|
||||
this.n = n;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parameterized() {
|
||||
assertEquals(1, n);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void other() {}
|
||||
}
|
||||
|
||||
public static class Broken {
|
||||
@BeforeClass
|
||||
public static void setUp() {
|
||||
throw new IllegalStateException("no database");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void never() {}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача