Skip to content
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

Improve tests in UnnecessaryParenthesesSpec #5197

Merged
merged 1 commit into from Aug 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -3,8 +3,11 @@ package io.gitlab.arturbosch.detekt.rules.style
import io.gitlab.arturbosch.detekt.test.TestConfig
import io.gitlab.arturbosch.detekt.test.lint
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Named
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource
import java.util.stream.Stream

class UnnecessaryParenthesesSpec {
@ParameterizedTest
Expand Down Expand Up @@ -332,15 +335,19 @@ class UnnecessaryParenthesesSpec {
companion object {
class RuleTestCase(val allowForUnclearPrecedence: Boolean) {
val rule = UnnecessaryParentheses(
TestConfig(mapOf("allowForUnclearPrecedence" to allowForUnclearPrecedence))
TestConfig("allowForUnclearPrecedence" to allowForUnclearPrecedence)
)
}

@JvmStatic
fun cases(): List<RuleTestCase> {
return listOf(
RuleTestCase(allowForUnclearPrecedence = false),
RuleTestCase(allowForUnclearPrecedence = true),
fun cases(): Stream<Arguments> {
return Stream.of(
Arguments.of(
Named.of("Without allow for unclear precedence", RuleTestCase(allowForUnclearPrecedence = false))
),
Arguments.of(
Named.of("With allow for unclear precedence", RuleTestCase(allowForUnclearPrecedence = true))
),
)
}
}
Expand Down