OsUtils { public static String getOsAgentName() { if (isAndroidOs()) { return OsNames.ANDROID_OS_NAME.agentName; } String currentOsName = System.getProperty("os.name").toLowerCase(); for (OsNames osName : OsNames.values()) { if (currentOsName.startsWith(osName.name)) { return osName.agentName; } } return OsNames.UNKNOWN_OS.agentName; }  static String getOsAgentName();  }
@Test public void test_os_type() { Class androidClass = null; try { androidClass = Class.forName("android.os.Build"); } catch (ClassNotFoundException e) { } if (androidClass != null) { assertEquals(ANDROID_OS_NAME, OsUtils.getOsAgentName()); return; } String osName = System.getProperty("os.name").toLowerCase(); if (osName.startsWith(LINUX_OS_NAME)) { assertEquals(LINUX_OS_NAME, OsUtils.getOsAgentName()); } else if (osName.startsWith(WINDOWS_OS_NAME)) { assertEquals(WINDOWS_OS_NAME, OsUtils.getOsAgentName()); } else if (osName.startsWith(MACOS_OS_NAME)) { assertEquals(VIRGIL_AGENT_MACOS, OsUtils.getOsAgentName()); } else { assertEquals(UNKNOWN_OS, OsUtils.getOsAgentName()); } }