Ahmed Riyadh
05/24/2024, 3:39 PMfun currentDesktopPlatform(): DesktopSystem {
val operatingSystem: String = System.getProperty("os.name")?.lowercase() ?: return Unknown
return when {
// Example
(listOf("nix", "nux", "aix", "linux").any { operatingSystem.contains(it) }) -> Linux
operatingSystem.contains("mac") -> MacOS
listOf("win", "windows").any { operatingSystem.contains(it) } -> Windows
else -> Unknown
}
}
I want to run some tests for this current static method for all operating systems but I only need to simulate the result of System.getProperty("os.name")
without manually hardcode the value or change it in tests