junit 5 M6

This commit is contained in:
Anna.Kozlova
2017-07-19 11:51:17 +02:00
parent f91a610b85
commit 5ee77412aa
17 changed files with 27 additions and 34 deletions
+7 -7
View File
@@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="junit5_rt">
<CLASSES>
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-jupiter-engine-5.0.0-M5.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-commons-1.0.0-M5.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-engine-1.0.0-M5.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-launcher-1.0.0-M5.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-runner-1.0.0-M5.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-vintage-engine-4.12.0-M5.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-suite-api-1.0.0-M5.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-jupiter-engine-5.0.0-M6.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-commons-1.0.0-M6.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-engine-1.0.0-M6.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-launcher-1.0.0-M6.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-runner-1.0.0-M6.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-vintage-engine-4.12.0-M6.jar!/" />
<root url="jar://$PROJECT_DIR$/plugins/junit5_rt/lib/junit-platform-suite-api-1.0.0-M6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -203,7 +203,7 @@ class CommunityRepositoryModules {
withModule("junit5_rt", "junit5-rt.jar")
withProjectLibrary("junit5_rt")
withProjectLibrary("opentest4j")
withModuleLibrary("junit-jupiter-api-5.0.0-M5.jar", "junit5_rt_tests", "")
withModuleLibrary("junit-jupiter-api-5.0.0-M6.jar", "junit5_rt_tests", "")
},
plugin("ByteCodeViewer") {
mainJarName = "byteCodeViewer.jar"
+1 -1
View File
@@ -10,7 +10,7 @@
<orderEntry type="module-library" scope="TEST">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../junit5_rt/lib/junit-jupiter-api-5.0.0-M5.jar!/" />
<root url="jar://$MODULE_DIR$/../junit5_rt/lib/junit-jupiter-api-5.0.0-M6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -209,7 +209,7 @@ public class JUnit5IntegrationTest extends JUnitAbstractCompilingIntegrationTest
@Override
protected JpsMavenRepositoryLibraryDescriptor[] getRequiredLibs() {
return new JpsMavenRepositoryLibraryDescriptor[] {
new JpsMavenRepositoryLibraryDescriptor("org.junit.jupiter", "junit-jupiter-api", "5.0.0-M5"),
new JpsMavenRepositoryLibraryDescriptor("org.junit.jupiter", "junit-jupiter-api", "5.0.0-M6"),
new JpsMavenRepositoryLibraryDescriptor("junit", "junit", "4.12")
};
}
@@ -19,8 +19,8 @@ import com.intellij.openapi.util.text.StringUtil;
import jetbrains.buildServer.messages.serviceMessages.MapSerializerUtil;
import org.junit.jupiter.api.*;
import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
import org.junit.jupiter.engine.descriptor.MethodTestDescriptor;
import org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor;
import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
import org.junit.platform.engine.TestDescriptor;
import org.junit.platform.engine.TestExecutionResult;
import org.junit.platform.engine.UniqueId;
@@ -70,7 +70,7 @@ class JUnit5EventsTest {
@Test
void multipleFailures() throws Exception {
TestDescriptor testDescriptor = new MethodTestDescriptor(UniqueId.forEngine("engine"), TestClass.class,
TestDescriptor testDescriptor = new TestMethodTestDescriptor(UniqueId.forEngine("engine"), TestClass.class,
TestClass.class.getDeclaredMethod("test1"));
TestIdentifier identifier = TestIdentifier.from(testDescriptor);
myExecutionListener.executionStarted(identifier);
@@ -18,7 +18,7 @@ package com.intellij.junit5;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.engine.descriptor.MethodTestDescriptor;
import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
import org.junit.platform.engine.TestSource;
import org.junit.platform.engine.UniqueId;
import org.junit.platform.engine.support.descriptor.*;
@@ -36,15 +36,14 @@ class JUnit5NavigationTest {
@Test
void methodNavigation() throws Exception {
UniqueId uniqueId = UniqueId.parse("[class:JUnit5NavigationTest]/[method:methodNavigation]");
MethodTestDescriptor methodTestDescriptor =
new MethodTestDescriptor(uniqueId, JUnit5NavigationTest.class, JUnit5NavigationTest.class.getDeclaredMethod("methodNavigation"));
TestMethodTestDescriptor methodTestDescriptor =
new TestMethodTestDescriptor(uniqueId, JUnit5NavigationTest.class, JUnit5NavigationTest.class.getDeclaredMethod("methodNavigation"));
TestIdentifier testIdentifier = TestIdentifier.from(methodTestDescriptor);
Assertions.assertEquals(JUnit5NavigationTest.class.getName(), JUnit5TestExecutionListener.getClassName(testIdentifier));
Assertions.assertEquals("methodNavigation", JUnit5TestExecutionListener.getMethodName(testIdentifier));
//Assertions.assertEquals("methodNavigation", testIdentifier.getDisplayName()); todo methodNavigation()
}
private final ConfigurableTestDescriptor descriptor = new ConfigurableTestDescriptor();
private TestSource myTestSource = null;
@Test
@@ -73,7 +72,6 @@ class JUnit5NavigationTest {
@Test
void locationHintValueForMethodSource() {
myTestSource = new MethodSource("className", "methodName");
descriptor.use(myTestSource);
String locationHintValue = locationHintValue();
Assertions.assertTrue(locationHintValue.startsWith("java:"), locationHintValue);
@@ -83,7 +81,6 @@ class JUnit5NavigationTest {
@Test
void locationHintValueForClassSource() {
myTestSource = new ClassSource(String.class);
descriptor.use(myTestSource);
String locationHintValue = locationHintValue();
Assertions.assertTrue(locationHintValue.startsWith("java:"), locationHintValue);
@@ -93,12 +90,12 @@ class JUnit5NavigationTest {
@Test
void deriveSuiteOrTestFromDescription() {
myTestSource = methodOrClassSource();
descriptor.isTest(true);
Assertions.assertTrue(locationHintValue().startsWith("java:test:"));
descriptor.isTest(false);
Assertions.assertTrue(locationHintValue().startsWith("java:suite:"));
ConfigurableTestDescriptor descriptor = new ConfigurableTestDescriptor(myTestSource);
descriptor.isTest(true);
Assertions.assertTrue(locationHintValue(descriptor).startsWith("java:test:"));
}
@Test
@@ -133,13 +130,15 @@ class JUnit5NavigationTest {
}
private String locationHint() {
descriptor.use(myTestSource);
TestIdentifier testIdentifier = TestIdentifier.from(descriptor);
TestIdentifier testIdentifier = TestIdentifier.from(new ConfigurableTestDescriptor(myTestSource));
return JUnit5TestExecutionListener.getLocationHint(testIdentifier);
}
private String locationHintValue() {
descriptor.use(myTestSource);
return locationHintValue(new ConfigurableTestDescriptor(myTestSource));
}
private static String locationHintValue(final ConfigurableTestDescriptor descriptor) {
TestIdentifier testIdentifier = TestIdentifier.from(descriptor);
return JUnit5TestExecutionListener.getLocationHintValue(testIdentifier.getSource().orElseThrow(IllegalStateException::new), testIdentifier.isTest());
}
@@ -168,16 +167,10 @@ class JUnit5NavigationTest {
private static class ConfigurableTestDescriptor extends AbstractTestDescriptor {
private boolean myIsTest;
public ConfigurableTestDescriptor() {
super(JUnit5NavigationTest.anyUniqueId(), JUnit5NavigationTest.anyDisplayName());
public ConfigurableTestDescriptor(TestSource testSource) {
super(JUnit5NavigationTest.anyUniqueId(), JUnit5NavigationTest.anyDisplayName(), testSource);
}
public void use(TestSource testSource) {
if (null == testSource) {
return;
}
setSource(testSource);
}
@Override
public Type getType() {