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

Add value class assertion test #5474

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ package net.mullvad.mullvadvpn.model
import android.os.Parcelable
import kotlinx.parcelize.Parcelize

@JvmInline @Parcelize value class Providers(val providers: HashSet<String>) : Parcelable
@Suppress("ensure value classes property is named value")
@JvmInline
@Parcelize
value class Providers(val providers: HashSet<String>) : Parcelable
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package net.mullvad.mullvadvpn.lib.payment

@JvmInline value class PaymentProvider(val paymentRepository: PaymentRepository?)
data class PaymentProvider(val paymentRepository: PaymentRepository?)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package net.mullvad.mullvadvpn.test.arch.classes

import com.lemonappdev.konsist.api.Konsist
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withValueModifier
import com.lemonappdev.konsist.api.ext.list.properties
import com.lemonappdev.konsist.api.verify.assertTrue
import org.junit.Test

class ValueClassTests {
@Test
fun `ensure value classes property is named value`() {
Konsist.scopeFromProject().classes(includeNested = true).withValueModifier().assertTrue {
it.properties(includeNested = false, includeLocal = false).firstOrNull { property ->
property.name == "value"
} != null
}
}
}
Loading