Rasmus Larsen
10/14/2024, 1:11 PMdata class Feature(val name: String, val enabled: Boolean)
object Features{
val featureOne = Feature(name = "FeatureOne", enabled = false)
val featureTwo = Feature(name = "FeatureTwo, enabled = true)
}
So I want to assert that enabled for Feature class declarations is falsePoisonedYouth
10/15/2024, 6:19 AMval propertyRegex = Regex("enabled\\s*=\\s*true")
Konsist.scopeFromProduction()
.objects()
.withName("Features")
.properties()
//.withTypeOf(Feature::class)
.assertTrue {
it.value == null || !propertyRegex.containsMatchIn(it.value!!)
}
The withTypeOf - filter is only working when using explicit type declaration.
This kind of test is not very stable. because changing the interna of the Feature class possibly makes an update of the test necessary.igor.wojda
10/15/2024, 9:34 PMtext property (value is better here) for string comparisons if needed.