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

UseSumOfInsteadOfFlatMapSizeSpec: don't use unnecessary @DisplayName #5416

Merged
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 @@ -4,16 +4,14 @@ import io.gitlab.arturbosch.detekt.rules.KotlinCoreEnvironmentTest
import io.gitlab.arturbosch.detekt.test.compileAndLintWithContext
import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test

@KotlinCoreEnvironmentTest
class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
val subject = UseSumOfInsteadOfFlatMapSize()

@Test
@DisplayName("Reports flatMap and size")
fun reportFlatMapAndSize() {
fun `reports flatMap and size`() {
val code = """
fun test(list: List<Foo>) {
list.flatMap { it.foo }.size
Expand All @@ -26,8 +24,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Reports flatMap and count")
fun reportFlatMapAndCount() {
fun `reports flatMap and count`() {
val code = """
fun test(list: List<Foo>) {
list.flatMap { it.foo }.count()
Expand All @@ -40,8 +37,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Reports flatMap and count with a argument")
fun reportFlatMapAndCountWithArgument() {
fun `reports flatMap and count with a argument`() {
val code = """
fun test(list: List<Foo>) {
list.flatMap { it.foo }.count { it > 2 }
Expand All @@ -54,8 +50,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Reports flatten and size")
fun reportFlattenAndSize() {
fun `reports flatten and size`() {
val code = """
fun test(list: List<List<Int>>) {
list.flatten().size
Expand All @@ -68,8 +63,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Reports flatMap and size on nullable list")
fun reportFlatMapAndSizeOnNullableList() {
fun `reports flatMap and size on nullable list`() {
val code = """
fun test(list: List<Foo>?) {
list?.flatMap { it.foo }?.size
Expand All @@ -81,8 +75,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Reports flatMap and size on implicit list receiver")
fun reportFlatMapAndSizeOnImplicitListReceiver() {
fun `reports flatMap and size on implicit list receiver`() {
val code = """
fun List<Foo>.test() {
flatMap { it.foo }.size
Expand All @@ -95,8 +88,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Reports flatMap and count on Set")
fun reportFlatMapAndCountOnSet() {
fun `reports flatMap and count on Set`() {
val code = """
fun test(set: Set<Bar>) {
set.flatMap { it.bar }.count()
Expand All @@ -108,8 +100,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Does not report flatMap")
fun noReportFlatMap() {
fun `does not report flatMap`() {
val code = """
fun test(list: List<Foo>) {
list.flatMap { it.foo }
Expand All @@ -121,8 +112,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Does not report flatMap and first")
fun noReportFlatMapAndFirst() {
fun `does not report flatMap and first`() {
val code = """
fun test(list: List<Foo>) {
list.flatMap { it.foo }.first()
Expand All @@ -134,8 +124,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Does not report flatten")
fun noReportFlatten() {
fun `does not report flatten`() {
val code = """
fun test(list: List<List<Int>>) {
list.flatten()
Expand All @@ -147,8 +136,7 @@ class UseSumOfInsteadOfFlatMapSizeSpec(val env: KotlinCoreEnvironment) {
}

@Test
@DisplayName("Does not report flatten and last")
fun noReportFlattenAndLast() {
fun `does not report flatten and last`() {
val code = """
fun test(list: List<List<Int>>) {
list.flatten().last()
Expand Down