33import org .junit .jupiter .api .Assertions ;
44import org .junit .jupiter .api .BeforeAll ;
55import org .junit .jupiter .api .Test ;
6- import org .junit .jupiter .api .condition .EnabledIf ;
6+ import org .junit .jupiter .api .condition .EnabledIfEnvironmentVariable ;
77import org .junit .jupiter .api .condition .EnabledOnOs ;
88import org .junit .jupiter .api .condition .OS ;
99
1515 * Unit tests for KWallet access via DBUS.
1616 */
1717@ EnabledOnOs (OS .LINUX )
18- @ EnabledIf ( "osEnvironmentSuitable " )
18+ @ EnabledIfEnvironmentVariable ( named = "DISPLAY" , matches = ".* " )
1919public class KDEWalletKeychainAccessTest {
2020
2121 private static boolean isInstalled ;
2222
2323 @ BeforeAll
2424 public static void checkSystemAndSetup () throws IOException {
25- ProcessBuilder dbusSend = new ProcessBuilder ("dbus-send" ,"--print-reply" ,"--dest=org.freedesktop.DBus" , "/org/freedesktop/DBus" , "org.freedesktop.DBus.ListNames " );
26- ProcessBuilder grep = new ProcessBuilder ("grep" , "org.kde.kwallet" );
25+ ProcessBuilder dbusSend = new ProcessBuilder ("dbus-send" , "--print-reply" , "--dest=org.freedesktop.DBus" , "/org/freedesktop/DBus" , "org.freedesktop.DBus.ListActivatableNames " );
26+ ProcessBuilder grep = new ProcessBuilder ("grep" , "-q" , " org.kde.kwallet" );
2727 try {
2828 Process end = ProcessBuilder .startPipeline (List .of (dbusSend , grep )).get (1 );
2929 if (end .waitFor (1000 , TimeUnit .MILLISECONDS )) {
@@ -42,9 +42,4 @@ public void testIsSupported() {
4242 KDEWalletKeychainAccess keychainAccess = new KDEWalletKeychainAccess ();
4343 Assertions .assertEquals (isInstalled , keychainAccess .isSupported ());
4444 }
45-
46-
47- private static boolean osEnvironmentSuitable () {
48- return System .getenv ().containsKey ("DISPLAY" );
49- }
5045}
0 commit comments