Is there a way to mock the current desktop platfor...
# random
a
Is there a way to mock the current desktop platform for basic testing to simulate the operating system (Linux, macOS and Windows) without actually need CI tests that will run on different platforms or the need of different platforms? for example let's say you have this:
Copy code
fun 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