<!-- Maven --> <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <version>5.x.x</version> <scope>test</scope> </dependency> // Gradle testImplementation 'org.junit.vintage:junit-vintage-engine:5.x.x' junit.jupiter.extensions.autodetection.enabled=true junit.jupiter.extensions.autodetection.discovery-mode=classpath @RunWith(JUnitPlatform.class) public class VintageTests { // ... } import junit.framework.TestCase; public class MyJUnit3Test extends TestCase { public void testAddition() { int result = 2 + 2; assertEquals(4, result); } } import org.junit.Test; import static org.junit.Assert.assertEquals; public class MyJUnit4Test { @Test public void additionTest() { int result = 2 + 2; assertEquals(4, result); } }


上一篇:
下一篇:
切换中文