Skip to content

Commit

Permalink
Add value class assertion test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Nov 21, 2023
1 parent 57085fc commit 79c53ac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
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
}
}
}

0 comments on commit 79c53ac

Please sign in to comment.