New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate detekt-gradle-plugin tests to JUnit #4529
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4529 +/- ##
=========================================
Coverage 84.45% 84.45%
Complexity 3330 3330
=========================================
Files 479 479
Lines 11143 11143
Branches 2040 2040
=========================================
Hits 9411 9411
Misses 699 699
Partials 1033 1033
Continue to review full report at Codecov.
|
e07a375
to
1da11fb
Compare
...-gradle-plugin/src/testFixtures/kotlin/io/gitlab/arturbosch/detekt/testkit/DslTestBuilder.kt
Outdated
Show resolved
Hide resolved
fun scenarios(): List<Arguments> = listOf( | ||
arguments(groovy, groovyBuildFileContent), | ||
arguments(kotlin, kotlinBuildFileContent) | ||
) | ||
|
||
@ParameterizedTest(name = "Using {0}") | ||
@MethodSource("scenarios") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit this! For sure it will not compile.
fun scenarios(): List<Arguments> = listOf( | |
arguments(groovy, groovyBuildFileContent), | |
arguments(kotlin, kotlinBuildFileContent) | |
) | |
@ParameterizedTest(name = "Using {0}") | |
@MethodSource("scenarios") | |
class Scenarios : ArgumentsProvider { | |
override fun provideArguments(context: ExtensionContext) = Stream.of( | |
arguments(DslTestBuilder.groovy(), groovyBuildFileContent), | |
arguments(DslTestBuilder.kotlin(), kotlinBuildFileContent), | |
) | |
} | |
@ParameterizedTest(name = "Using {0}") | |
@ArgumentsSource(DetektReportMergeSpec.Scenarios::class) |
But what do you think of something like this? It avoid String
references that are easier to break. The problem is that it's more verbose. It's just a suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the string reference is OK in this case, given the function sits directly above the test method. Also I just tried and IntelliJ will update the string in the annotation if the method is renamed using Refactor -> Rename in the IDE, and also if the string itself is renamed with Refactor -> Rename.
...-gradle-plugin/src/testFixtures/kotlin/io/gitlab/arturbosch/detekt/testkit/DslTestBuilder.kt
Show resolved
Hide resolved
...-gradle-plugin/src/testFixtures/kotlin/io/gitlab/arturbosch/detekt/testkit/DslTestBuilder.kt
Outdated
Show resolved
Hide resolved
...-gradle-plugin/src/testFixtures/kotlin/io/gitlab/arturbosch/detekt/testkit/DslTestBuilder.kt
Outdated
Show resolved
Hide resolved
f7e9c28
to
7de8135
Compare
7de8135
to
e675225
Compare
PR is complete so this is ready for a fresh review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me 👍 Diff is quite big so I haven't looked into too much details as I believe most of the changes were auto-generated.
...-gradle-plugin/src/testFixtures/kotlin/io/gitlab/arturbosch/detekt/testkit/DslTestBuilder.kt
Show resolved
Hide resolved
...-gradle-plugin/src/testFixtures/kotlin/io/gitlab/arturbosch/detekt/testkit/DslTestBuilder.kt
Show resolved
Hide resolved
detekt-gradle-plugin/src/test/kotlin/io/gitlab/arturbosch/detekt/report/ReportMergeSpec.kt
Outdated
Show resolved
Hide resolved
Ahahah my brain refuses to process whatever is above 1k loc 😅 |
* Migrate detekt-gradle-plugin functional tests to JUnit * Migrate detekt-gradle-plugin tests to JUnit * Remove unused dependencies * Removed unused function
See #4450