jvmMain.io.mockk.MockKSettings.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockk-dsl-jvm Show documentation
Show all versions of mockk-dsl-jvm Show documentation
Java MockK DSL providing API for MockK implementation
package io.mockk
import java.util.Properties
actual object MockKSettings {
private val properties = Properties()
init {
MockKSettings::class.java
.getResourceAsStream("settings.properties")
?.use(properties::load)
}
private fun booleanProperty(property: String, defaultValue: String) =
properties.getProperty(
property,
defaultValue
)!!.toBoolean()
actual val relaxed: Boolean
get() = booleanProperty("relaxed", "false")
actual val relaxUnitFun: Boolean
get() = booleanProperty("relaxUnitFun", "false")
actual val recordPrivateCalls: Boolean
get() = booleanProperty("recordPrivateCalls", "false")
actual val stackTracesOnVerify: Boolean
get() = booleanProperty("stackTracesOnVerify", "true")
actual val stackTracesAlignment: StackTracesAlignment
get() = stackTracesAlignmentValueOf(properties.getProperty("stackTracesAlignment", "center"))
fun setRelaxed(value: Boolean) {
properties.setProperty("relaxed", value.toString())
}
fun setRelaxUnitFun(value: Boolean) {
properties.setProperty("relaxUnitFun", value.toString())
}
fun setRecordPrivateCalls(value: Boolean) {
properties.setProperty("recordPrivateCalls", value.toString())
}
fun setStackTracesAlignment(value: String) {
properties.setProperty("stackTracesAlignment", value)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy