Skip to content

Commit

Permalink
Fix parameterized class being appended
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelpasterz committed Oct 12, 2020
1 parent 80d7b57 commit 7585eaa
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.test_app.similar

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.example.test_app.BaseInstrumentedTest
import org.junit.Ignore
import androidx.test.filters.Suppress
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class SimilarNameTest1 : BaseInstrumentedTest() {

@Test
fun test1() = testMethod()

@Test
fun test2() = testMethod()

@Test
fun test19() = testMethod()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.test_app.similar

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.example.test_app.BaseInstrumentedTest
import org.junit.Ignore
import androidx.test.filters.Suppress
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class SimilarNameTest10 : BaseInstrumentedTest() {

@Test
fun test1() = testMethod()

@Test
fun test2() = testMethod()

@Test
fun test19() = testMethod()
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ internal fun InstrumentationTestContext.getFlankTestMethods(
.filter(testFilter.shouldRun)
.filterNot(parameterizedClasses::belong)
.map(TestMethod::toFlankTestMethod).toList()
.plus(parameterizedClasses.map(String::toFlankTestMethod))
.plus(parameterizedClasses
.filter { testFilter.shouldRun(TestMethod(it, emptyList())) }
.map(String::toFlankTestMethod))
}

private fun List<String>.belong(method: TestMethod) = any { className -> method.testName.startsWith(className) }
Expand Down

0 comments on commit 7585eaa

Please sign in to comment.