diff --git a/core/src/test/java/test/NativeLibraryTest.java b/core/src/test/java/test/NativeLibraryTest.java index 4beb4980..128fdfe1 100644 --- a/core/src/test/java/test/NativeLibraryTest.java +++ b/core/src/test/java/test/NativeLibraryTest.java @@ -47,6 +47,7 @@ public class NativeLibraryTest { @Test @EnabledOnOs(OS.WINDOWS) public void testWindowsLibraryLoading() { + if (!isAdmin()) return; WindowsLibrary library = new TestWindowsLibrary(); Assertions.assertNotNull(getClass().getResource(library.getX64Path() + library.getLibraryName()), "x64 library doesn't exist"); @@ -56,6 +57,15 @@ public class NativeLibraryTest { Assertions.assertTrue(library.isLoaded(), "Windows library isn't loaded"); } + private static boolean isAdmin() { + String[] groups = (new com.sun.security.auth.module.NTSystem()).getGroupIDs(); + for (String group : groups) { + if ("S-1-5-32-544".equals(group)) + return true; + } + return false; + } + private static class TestMacOsLibrary extends MacOSLibrary { @Override protected void error(final String message, final Throwable e) {