Skip to content

Commit 5e6ecad

Browse files
committed
use @EnabledIfEnvironmentVariable annotation
1 parent fd9aede commit 5e6ecad

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/test/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccessTest.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.junit.jupiter.api.Assertions;
44
import org.junit.jupiter.api.BeforeAll;
55
import org.junit.jupiter.api.Test;
6-
import org.junit.jupiter.api.condition.EnabledIf;
6+
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
77
import org.junit.jupiter.api.condition.EnabledOnOs;
88
import org.junit.jupiter.api.condition.OS;
99

@@ -15,15 +15,15 @@
1515
* Unit tests for KWallet access via DBUS.
1616
*/
1717
@EnabledOnOs(OS.LINUX)
18-
@EnabledIf("osEnvironmentSuitable")
18+
@EnabledIfEnvironmentVariable(named = "DISPLAY", matches = ".*")
1919
public 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

Comments
 (0)