[gradle] code cleanup by code review IDEA-232317 IJ-MR-5829

GitOrigin-RevId: 72705f5cae3a9af88c0f85d39d41402c41247f7d
This commit is contained in:
Nikita Skvortsov
2021-02-18 10:18:51 +00:00
committed by intellij-monorepo-bot
parent 1f5acb198f
commit 981d02ff85
3 changed files with 8 additions and 9 deletions
@@ -53,7 +53,7 @@ public class GradleTestEventsProcessor {
}
}
if (event instanceof ExternalSystemFinishEvent) {
if (descriptor.getMethodName() == null) {
if (StringUtil.isEmpty(descriptor.getMethodName())) {
return TestEventType.AFTER_SUITE;
} else {
return TestEventType.AFTER_TEST;
@@ -2,7 +2,6 @@
package org.jetbrains.plugins.gradle.execution.test
import com.intellij.openapi.externalSystem.model.task.*
import com.intellij.openapi.externalSystem.model.task.event.ExternalSystemProgressEvent
import com.intellij.openapi.externalSystem.model.task.event.ExternalSystemTaskExecutionEvent
import com.intellij.openapi.externalSystem.model.task.event.TestOperationDescriptor
import com.intellij.openapi.util.Pair
@@ -115,9 +114,9 @@ open class GradleJavaTestEventsIntegrationTest: GradleImportingTestCase() {
private fun extractTestClassesAndMethods(testListener: LoggingESStatusChangeListener) =
testListener.eventLog
.filterIsInstance<ExternalSystemTaskExecutionEvent>()
.map { it.progressEvent }
.filterIsInstance<ExternalSystemProgressEvent<TestOperationDescriptor>>()
.map { it.descriptor.run { className to methodName } }
.map { it.progressEvent.descriptor }
.filterIsInstance<TestOperationDescriptor>()
.map { it.run { className to methodName } }
private fun `call test task produces test events`() {
val testEventListener = LoggingESStatusChangeListener()
@@ -211,9 +210,9 @@ open class GradleJavaTestEventsIntegrationTest: GradleImportingTestCase() {
if (testLauncherAPISupported()) {
val testOperationDescriptors = testEventListener.eventLog
.filterIsInstance<ExternalSystemTaskExecutionEvent>()
.map { it.progressEvent }
.filterIsInstance<ExternalSystemProgressEvent<TestOperationDescriptor>>()
.map { it.descriptor.run { "$className$$methodName" to displayName } }
.map { it.progressEvent.descriptor }
.filterIsInstance<TestOperationDescriptor>()
.map { it.run { "$className$$methodName" to displayName } }
assertThat(testOperationDescriptors)
.contains("my.otherpack.ADisplayNamedTest\$successful_test()" to "successful test")
@@ -685,7 +685,7 @@ public class GradleExecutionHelper {
* Args list will contain all other known arguments.
*
* @param args full command line
* @return test tasks geouped with its patterns
* @return test tasks grouped with its patterns
*/
static MultiMap<String, String> extractTestCommandOptions(@NotNull List<String> args) {
MultiMap<String, String> taskToTestsPatterns = new MultiMap<>();