Add SystemUtils.IS_OS_MAC_OSX_SONOMA

This commit is contained in:
Gary Gregory 2024-05-30 14:33:14 -04:00
parent d0bb31bc10
commit ff66cce0ca
3 changed files with 24 additions and 0 deletions

View File

@ -67,6 +67,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add MethodUtils.getMethodObject(Class, String, Class...).</action>
<action issue="LANG-1733" type="add" dev="ggregory" due-to="Jongjin Bae, Gary Gregory">Add null-safe Consumers.accept() and Functions.apply() #1215.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_OS_ANDROID.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add SystemUtils.IS_OS_MAC_OSX_SONOMA.</action>
<!-- FIX -->
<action type="fix" dev="ggregory" due-to="Miklós Karakó, Gary Gregory">Improve Javadoc in ExceptionUtils #1136.</action>
<action type="fix" dev="ggregory" due-to="Saiharshith Karuneegar Ramesh, Gary Gregory">Fixed two non-deterministic tests in EnumUtilsTest.java #1131.</action>

View File

@ -1506,6 +1506,19 @@ public class SystemUtils {
*/
public static final boolean IS_OS_MAC_OSX_VENTURA = getOsMatches("Mac OS X", "13");
/**
* Is {@code true} if this is macOS X Sonoma.
*
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
* <p>
* This value is initialized when the class is loaded.
* </p>
* @since 3.15.0
*/
public static final boolean IS_OS_MAC_OSX_SONOMA = getOsMatches("Mac OS X", "14");
/**
* Is {@code true} if this is FreeBSD.
*

View File

@ -168,6 +168,16 @@ public class SystemUtilsTest extends AbstractLangTest {
assertTrue(SystemUtils.IS_OS_UNIX);
assertFalse(SystemUtils.IS_OS_ANDROID);
assertFalse(SystemUtils.IS_OS_WINDOWS);
final boolean macOsValues[] = { SystemUtils.IS_OS_MAC_OSX_BIG_SUR, SystemUtils.IS_OS_MAC_OSX_CATALINA, SystemUtils.IS_OS_MAC_OSX_CHEETAH,
SystemUtils.IS_OS_MAC_OSX_EL_CAPITAN, SystemUtils.IS_OS_MAC_OSX_HIGH_SIERRA, SystemUtils.IS_OS_MAC_OSX_JAGUAR,
SystemUtils.IS_OS_MAC_OSX_LEOPARD, SystemUtils.IS_OS_MAC_OSX_LION, SystemUtils.IS_OS_MAC_OSX_MAVERICKS, SystemUtils.IS_OS_MAC_OSX_MOJAVE,
SystemUtils.IS_OS_MAC_OSX_MONTEREY, SystemUtils.IS_OS_MAC_OSX_MOUNTAIN_LION, SystemUtils.IS_OS_MAC_OSX_PANTHER,
SystemUtils.IS_OS_MAC_OSX_PUMA, SystemUtils.IS_OS_MAC_OSX_SIERRA, SystemUtils.IS_OS_MAC_OSX_SNOW_LEOPARD, SystemUtils.IS_OS_MAC_OSX_SONOMA,
SystemUtils.IS_OS_MAC_OSX_TIGER, SystemUtils.IS_OS_MAC_OSX_VENTURA, SystemUtils.IS_OS_MAC_OSX_YOSEMITE };
if (BooleanUtils.or(macOsValues)) {
// If one is true, then only one should be true.
assertTrue(BooleanUtils.xor(macOsValues));
}
} else if (osName.startsWith("OS/2")) {
assertTrue(SystemUtils.IS_OS_OS2);
assertFalse(SystemUtils.IS_OS_UNIX);